Re: [PATCH 6/7] pipesz: report default size in --help, instead of referring the user

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Op 24-04-2025 om 13:24 schreef Nathan Sharp:
>      If it is to be done at all, it MUST be done inside the usage() function; 
> so that it is unlikely that future changes will introduce a read of an 
> uninitialized global variable.

Which variable would be uninitialized?  Global variable 'opt_size' gets
initialized to -1 in the beginning.  But okay, moving the two lines
before the call of usage() to the start of usage() itself is fine.

>      However, I do not think this is a good idea in isolation, as it deprives 
> the user of the knowledge of where the default size comes from,

Not at all: where the value comes from is mentioned in the man page.
The usage text is not meant to include _all_ details about the program
-- that is what the man page is for.  And, unlike the man page, the
usage text _can_ include the actual value of the thing.  And if it can,
it should, in my opinion, as the value itself is much more useful than
saying "go look there".

> and additionally could cause the help message to print a warning!

That is actually better than referring to a file that happens to be
unreadable/unparsable, because then the help text would be lying.


Benno
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmgKOY4FAwAAAAAACgkQUUu+Lrjhlh9w
gQ//Wh6jczA4PaVEdhn1tqgPEfg8Ah4ElVyHMtyQKwWZKnRjpAfFtAMeSkI+vwQUdhN0fb4WyCJg
L9yaXEwx88E+YnZN4JClvfuchqXjqjfADr7y/r/SdO+fpIDDDLxRLN8AueCTG1I79z7MPkA6Iaz+
lwDQ5vQfwlV3ZSihN53pfjjLBOA20VM904p4ipWijjGH6K9zBcZouJ7lJfmIoqx3a8p0nnKhqHwi
Gy4JgRp3IMAG6W6RM3M3bSu8B4dm6SvQrvuGEw2JtNSQf+Kr6o2qq4VYf2C5EdvbNCto3tPeypNn
jdfyU9Ns+x/41FfrERZe2AfU4qhRGTrgZHA3QgHVudPgo6tU6YMWLCZTYebZd8T0Kmyx+QkpxJpd
cJ7pXVp9YPuCbbCQubqifMswrZUc7/0OH+qcW6ToMawYYQyidpDQ+l2bzZ5bWlt75djxkYRFo+PD
pIfkjC7eq+38XnBcmRlXWzLbGVkgKtDOmJtjF3asptLShlAYrffcsGr6mLUZ9DnOl2XM6Sx4M0JQ
vd0zGJ3EnwjQNue+9bBAET13zksk9kukV2nC8jby/wyWNxJ0cWDIJR0nFg890nUCcMK0uHp3NdQ5
axyjwSs0I0TBzf1kxGerOW78xC+1pwwnJNJ+QZ8aJ9I2aIpg7er17PUrMUDnXC165rP5tfhYLars
Cj0=
=ZoeT
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.