Date: Mon, 15 Sep 2025 08:49:03 -0300 From: "Danilo G. Baio" <dbaio@FreeBSD.org> To: "James Gritton" <jamie@gritton.org>, "Kyle Evans" <kevans@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: dbaaadd4373a - main - jls: minor simplification to arg handling Message-ID: <ea0dc4ca-b314-4e54-8af2-492bb97f7215@app.fastmail.com> In-Reply-To: <ce54cd059089797e4a2dcd974ad32459@gritton.org> References: <202507260314.56Q3E5cY002869@gitrepo.freebsd.org> <54e7f090-c031-47f2-bc51-c020a77ab00a@app.fastmail.com> <abf51345-d48b-4e13-a2f0-2fdda37914ce@FreeBSD.org> <ac8e382e-1f04-46dd-9e8f-2bf378fcc998@FreeBSD.org> <ce54cd059089797e4a2dcd974ad32459@gritton.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 15, 2025, at 01:05, James Gritton wrote: > On 2025-09-14 19:30, Kyle Evans wrote: >> On 9/14/25 20:00, Kyle Evans wrote: >>> On 9/14/25 19:14, Danilo G. Baio wrote: >>>>=20 >>>>=20 >>>> On Sat, Jul 26, 2025, at 00:14, Kyle Evans wrote: >>>>> The branch main has been updated by kevans: >>>>>=20 >>>>> URL: >>>>> https://cgit.FreeBSD.org/src/commit/?id=3Ddbaaadd4373a725950ad11e5= 78dab61537b7c4f2 >>>>>=20 >>>>> commit dbaaadd4373a725950ad11e578dab61537b7c4f2 >>>>> Author:=C2=A0=C2=A0=C2=A0=C2=A0 Kyle Evans <kevans@FreeBSD.org> >>>>> AuthorDate: 2025-07-26 03:13:41 +0000 >>>>> Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Kyle Evans <kevans@FreeBSD.org> >>>>> CommitDate: 2025-07-26 03:13:41 +0000 >>>>>=20 >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 jls: minor simplification to arg handling >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 It's easier to reason about the state of = argc/argv if we just=20 >>>>> augment >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 them by optind after our getopt() loop. >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 No functional change, but this sets the s= tage for another=20 >>>>> change to add >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 a `-c` mode to (c)heck for the existence = of a jail quietly=20 >>>>> without >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 the caller having to worry about spurious= output. >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0 jamie >>>>> =C2=A0=C2=A0=C2=A0=C2=A0 Differential Revision:=C2=A0 https://revi= ews.freebsd.org/D51540 >>>>> --- >>>>> =C2=A0 usr.sbin/jls/jls.c | 10 ++++++---- >>>>> =C2=A0 1 file changed, 6 insertions(+), 4 deletions(-) >>>>>=20 >>>>> diff --git a/usr.sbin/jls/jls.c b/usr.sbin/jls/jls.c >>>>> index bd193a69c458..a1d1716713aa 100644 >>>>> --- a/usr.sbin/jls/jls.c >>>>> +++ b/usr.sbin/jls/jls.c >>>>> @@ -140,8 +140,11 @@ main(int argc, char **argv) >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ip4_ok =3D feature_present("inet"); >>>>> =C2=A0 #endif >>>>>=20 >>>>> +=C2=A0=C2=A0=C2=A0 argc -=3D optind; >>>>> +=C2=A0=C2=A0=C2=A0 argv +=3D optind; >>>>> + >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Add the parameters to print. */ >>>>> -=C2=A0=C2=A0=C2=A0 if (optind =3D=3D argc) { >>>>> +=C2=A0=C2=A0=C2=A0 if (argc =3D=3D 0) { >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pflags = & (PRINT_HEADER | PRINT_NAMEVAL)) >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 add_param("all", NULL, (size_t)0, NULL, JP_USER); >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (pf= lags & PRINT_VERBOSE) { >>>>> @@ -179,9 +182,8 @@ main(int argc, char **argv) >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else { >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pflags &=3D= ~PRINT_VERBOSE; >>>>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while (optind < argc) >>>>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= add_param(argv[optind++], NULL, (size_t)0, NULL, >>>>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 JP_USER); >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (i =3D 0; i < argc= ; i++) >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= add_param(argv[i], NULL, (size_t)0, NULL, JP_USER); >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>>>>=20 >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pflags & PRINT_SKIP) { >>>>=20 >>>>=20 >>>> Hi, >>>>=20 >>>> Just replying to one of the recent changes on `jls`. >>>>=20 >>>> We use `jls -n` in many scripts, and recently, it stopped working. >>>>=20 >>>> The last build that was working for us: >>>> FreeBSD 15.0-CURRENT #0 main-n278879-4be9c6f38e78: Sat Jul 19=20 >>>> 13:19:25 UTC 2025 >>>>=20 >>>> We are now encountering the following issue on this build: >>>> FreeBSD 16.0-CURRENT #0 main-n280141-5e82eeccd252: Sat Sep=C2=A0 6=20 >>>> 05:27:34 UTC 2025 >>>>=20 >>>> $ jls -n >>>> desc=3D0 devfs_ruleset=3D0 nodying enforce_statfs=3D0 env=3D"" host= =3Ddisable=20 >>>> ip4=3Ddisable ip6=3Ddisable jid=3D0 meta=3D"" name=3D"" osreldate=3D= 0=20 >>>> osrelease=3D"" parent=3D0 path=3D"" nopersist securelevel=3D0 sysvm= sg=3Ddisable=20 >>>> sysvsem=3Ddisable sysvshm=3Ddisable vnet=3Ddisable zfs=3Ddisable=20 >>>> allow.noadjtime allow.nochflags allow.noextattr allow.nomlock=20 >>>> allow.nomount allow.mount.nodevfs allow.mount.nofdescfs=20 >>>> allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs=20 >>>> allow.mount.nozfs allow.nonfsd allow.noquotas allow.noraw_sockets=20 >>>> allow.noread_msgbuf allow.noreserved_ports allow.norouting=20 >>>> allow.noset_hostname allow.nosettime allow.nosocket_af allow.nosuse= r=20 >>>> allow.nosysvipc allow.nounprivileged_parent_tampering=20 >>>> allow.nounprivileged_proc_debug children.cur=3D0 children.max=3D0=20 >>>> cpuset.id=3D0 host.domainname=3D"" host.hostid=3D0 host.hostname=3D= ""=20 >>>> host.hostuuid=3D""=20 >>>> ip4.addr=3D0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0=20 >>>> ip4.nosaddrsel ip6.addr=3D::,::,::,::,::,:: ip6.nosaddrsel=20 >>>> zfs.mount_snapshot=3D0 >>>> desc=3D0 devfs_ruleset=3D0 nodying enforce_statfs=3D0 env=3D"" host= =3Ddisable=20 >>>> ip4=3Ddisable ip6=3Ddisable jid=3D0 meta=3D"" name=3D"" osreldate=3D= 0=20 >>>> osrelease=3D"" parent=3D0 path=3D"" nopersist securelevel=3D0 sysvm= sg=3Ddisable=20 >>>> sysvsem=3Ddisable sysvshm=3Ddisable vnet=3Ddisable zfs=3Ddisable=20 >>>> allow.noadjtime allow.nochflags allow.noextattr allow.nomlock=20 >>>> allow.nomount allow.mount.nodevfs allow.mount.nofdescfs=20 >>>> allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs=20 >>>> allow.mount.nozfs allow.nonfsd allow.noquotas allow.noraw_sockets=20 >>>> allow.noread_msgbuf allow.noreserved_ports allow.norouting=20 >>>> allow.noset_hostname allow.nosettime allow.nosocket_af allow.nosuse= r=20 >>>> allow.nosysvipc allow.nounprivileged_parent_tampering=20 >>>> allow.nounprivileged_proc_debug children.cur=3D0 children.max=3D0=20 >>>> cpuset.id=3D0 host.domainname=3D"" host.hostid=3D0 host.hostname=3D= ""=20 >>>> host.hostuuid=3D""=20 >>>> ip4.addr=3D0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0=20 >>>> ip4.nosaddrsel ip6.addr=3D::,::,::,::,::,:: ip6.nosaddrsel=20 >>>> zfs.mount_snapshot=3D0 >>>> desc=3D0 devfs_ruleset=3D0 nodying enforce_statfs=3D0 env=3D"" host= =3Ddisable=20 >>>> ip4=3Ddisable ip6=3Ddisable jid=3D0 meta=3D"" name=3D"" osreldate=3D= 0=20 >>>> osrelease=3D"" parent=3D0 path=3D"" nopersist securelevel=3D0 sysvm= sg=3Ddisable=20 >>>> sysvsem=3Ddisable sysvshm=3Ddisable vnet=3Ddisable zfs=3Ddisable=20 >>>> allow.noadjtime allow.nochflags allow.noextattr allow.nomlock=20 >>>> allow.nomount allow.mount.nodevfs allow.mount.nofdescfs=20 >>>> allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs=20 >>>> allow.mount.nozfs allow.nonfsd allow.noquotas allow.noraw_sockets=20 >>>> allow.noread_msgbuf allow.noreserved_ports allow.norouting=20 >>>> allow.noset_hostname allow.nosettime >>>> [...] >>>> infinite loop >>>>=20 >>>=20 >>> Adding jamie@, neither of the changes to jls(1) should've caused thi= s,=20 >>> as far as I can reason about (and I haven't observed this here, yet)= .=C2=A0=20 >>> This looks like a failure to terminate the print_jail loop at the en= d? >>=20 >> I still can't functionally update, but looking at the recent jaildesc=20 >> work, I wonder >> if this is a side effect that has since been fixed in=20 >> e75dda31c1eead9ad40580bd8 by >> removing the "desc" parameter. It would have been included in=20 >> jailparam_all(), and >> I wonder if that somehow broke jls-style iteration? > > I've verified that the patch stocks the problem, and took the liberty = of=20 > MFCing it a day early. > > - Jamie Thanks to both of you for taking a look at this. --=20 Danilo G. Baio
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ea0dc4ca-b314-4e54-8af2-492bb97f7215>