From nobody Tue Jan 18 18:15:15 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D9A34195E4EC for ; Tue, 18 Jan 2022 18:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JdcPv4DpBz3nZr for ; Tue, 18 Jan 2022 18:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BD9625ED4 for ; Tue, 18 Jan 2022 18:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20IIFFE6068209 for ; Tue, 18 Jan 2022 18:15:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20IIFFdS068208 for bugs@FreeBSD.org; Tue, 18 Jan 2022 18:15:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261200] Unable to pipe the output of jobs in sh Date: Tue, 18 Jan 2022 18:15:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: ron@digitalcombine.ca X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642529715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mUtxeicKCEP5nF2WQ16rIyd/l/tlzntxskciv0VkGCM=; b=ju+O610fu9MvvtAxCLXOAVSgXQx3LESS0XFbYwlFUzZbw9CPDGDccxVdd6y24wud62+kXn w4Pq04p2yH6m9T7lxqQi9bgC6O5BkNhAdUi4XjS37hkjaVJxLbrbvUd6XH4tE4YbIp5CBb fyYTOlSXwyD954wdQNQcQUNZ27qd+yCJxMbX+OZGOcG+P6ErL1DM20BTJ36IHtuyF+Ze8s pdXGFeD8YZsu19I8nrntLu/cgW97xgVnihGKc4Zav/Jx+qdIc3JnT8syemh2wBL9QNStCJ OBj4ONDqvVKLVfrtw7abAW4Q44KCP3KZziBrTJDWfQEUyTZUrH2YlgjFqDXVJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642529715; a=rsa-sha256; cv=none; b=M8Gx0NiYZJMBzupRo5Wq0YfXS3+75FNsTIBU7FEr3dX1qwYfDGNVLgIeyWtRRqLK1dztZI igC21u3H8sOSfUFE155AqNzxpWEu6KErgLadfMvv+WxrBiO9OwwHg6j8m/GOA30PQkQdXw u0loP7YX/X5JncwFVG3nEZeERcph35NyJ0+yYh1chG0xf6kgiyOkXaEhfs4PlzGpxWaysK j3axpeCmgG0e9ujEGeM4wTCQMYM47esMmwpwGsjBoVay2UexcilaZC5v+R1bapcHHFdQ6k vkiWp9FIBhGw/SDFCc9MZxP+39vQw85vNpYgqISjQ5YgzayRUGTAAdL4ek4Tjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261200 --- Comment #5 from Ron Wills --- While tracing a simple script like: sleep 1000& jobs jobs | cat I find that the first execution of jobs is executed by the shell process it= self and the second piped jobs is forked then executed in a child process. In bo= th cases the jobtab, found in jobs.c, has four entries in it but in the child process all the jobs are marked unused. In the function forkshell(), found in jobs.c, there's a section of code for= the new child process that clears the jobtab. for (i =3D njobs, p =3D jobtab ; -- i >=3D 0 ; p++) if (p->used) freejob(p); And this is the reason why jobs shows no entries when piped. I'm not sure why this is done. I'm assuming this is possibly to prevent the child process from doing some kind of job clean up later... I'll keep diggi= ng into this as time permits ;) --=20 You are receiving this mail because: You are the assignee for the bug.=