Hi Julian, On Tue, Dec 14, 2021 at 06:49:12AM +0000, Julian Gilbey wrote: > I discovered that in several of my autopkgtest scripts, and in various > other packages in the archive, the following pattern appears: I think (although I'm not an authoritative voice of any kind here) that you you are using the wrong option altogether actually. > cd somewhere > ... > for py in $(py3versions -r 2>/dev/null) > ... > > Unfortunately, this silently fails, Of course it's silent. you are asking something and then ignoring the output… > is given. The "2>/dev/null" is nevertheless usually required even > when run from the correct directory to silence the warning: > > py3versions: no X-Python3-Version in control file, using supported versions that's because you are using the wrong option. You should use `-s` instead of `-r` in those cases, and drop the 2>/dev/null. Besides, even if you keep the -r it wouldn't be much of a problem: $() only captures stdout, stderr just gets printed and doesn't interfere with the for loop or such, so why are you doing this? -r is used by dh_python and other build scripts because they have to support all packages, but IMHO you really should be using -s if you know you don't have X-Python3-Version in your package and you *really* want to just suppose whatever are the current supported python3 versions. > The corrected script should read something like: > > ... > for py in $(py3versions -r 2>/dev/null); do > cd somewhere > ... And then, `py3versions -s` will "just work" wherever you are, no need to do this fairly complicated check. > A regex such as /\bcd\b.*py3versions\s+-r/s applied to the entire > content of debian/tests/control and every other file in debian/tests > should catch this issue. Yeah sure, and then what about pushd ? Doing this kind of check in lintian is fraught with false positives, so I recommend the lintian maintainers don't try to do this. However, instead, I'd suggest that, after checking with the debian-python@ lists, we could tell people to use -s if and only if X-Python3-Version is not defined (conversely, we should warn if packages use -s if X-Python3-Version *is* defined, probably). -- regards, Mattia Rizzolo GPG Key: 66AE 2B4A FCCF 3F52 DA18 4D18 4B04 3FCD B944 4540 .''`. More about me: https://mapreri.org : :' : Launchpad user: https://launchpad.net/~mapreri `. `'` Debian QA page: https://qa.debian.org/developer.php?login=mattia `-
Attachment:
signature.asc
Description: PGP signature