NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/57253: xargs wraps lines after ~4k characters
The following reply was made to PR bin/57253; it has been noted by GNATS.
From: Marc Daniel Fege <marc%fege.net@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/57253: xargs wraps lines after ~4k characters
Date: Thu, 02 Mar 2023 12:44:41 +0100
Hello again RVP
> Well, most Unix systems have _some_ kind of limit on ARG_MAX. On
> Linux it is around 1MB; on FreeBSD it is ~512KB; on NetBSD/amd64
> it is:
>=20
> $ sysctl -n kern.argmax
> 262144
> $
>=20
> so, that's more that 4KB. And, as long as xargs doesn't _insert_
> a space where there should be none, it's behaving according to
> specs:
Indeed, some limit will be there anyway. But do those limits need to be=20
(artificially) defined in the userland programs themselves to handle an=20
otherwise comming up exception of the programming language or library? I me=
an,=20
the boundries between shells and tools have been pushed multiple times whic=
h I=20
clearly see in the last 20+ years. So why not again at least push those lim=
its=20
to the technical/architecture maximum and equalize them out? Some "quality =
of=20
life" improvement does not harm.
Kind regars
=2D Marc.
Am Donnerstag, 2. M=E4rz 2023, 12:25:01 CET schrieben Sie:
> The following reply was made to PR bin/57253; it has been noted by GNATS.
>=20
> From: RVP <rvp%SDF.ORG@localhost>
> To: gnats-bugs%netbsd.org@localhost
> Cc:
> Subject: Re: bin/57253: xargs wraps lines after ~4k characters
> Date: Thu, 2 Mar 2023 11:22:48 +0000 (UTC)
>=20
> On Thu, 2 Mar 2023, marc%fege.net@localhost wrote:
> > I have some very long output lines in various shell scripts needed
> > to be processed by xargs.
> > [...] As long as there is addressable memory available, no
> > command should forcefully ever wrap after a certain amount of line
> > length or stop working on an artificially limit set, even if this
> > limit had a reason in former times.
>=20
> Well, most Unix systems have _some_ kind of limit on ARG_MAX. On
> Linux it is around 1MB; on FreeBSD it is ~512KB; on NetBSD/amd64
> it is:
>=20
> $ sysctl -n kern.argmax
> 262144
> $
>=20
> so, that's more that 4KB. And, as long as xargs doesn't _insert_
> a space where there should be none, it's behaving according to
> specs:
>=20
> ```
> $ cat a.awk
> #!/usr/bin/awk -f
>=20
> BEGIN {
> cmd =3D "sysctl -n kern.argmax"
> cmd | getline MAX
> close(cmd)
> for (i =3D 0; i < MAX * 5; i +=3D length(s)) {
> s =3D s "a"
> print s
> }
> }
> $ chmod u+x a.awk
> $ ./a.awk > 1
> $ ./a.awk | xargs printf '%s\n' > 2
> $ cmp 1 2 && echo OK
> OK
> $
> ```
>=20
> -RVP
Home |
Main Index |
Thread Index |
Old Index