#558989 dash reverses the established logic of test -nt -ot (and maybe others)

Package:
dash
Source:
dash
Description:
POSIX-compliant shell
Submitter:
Ron
Date:
2025-01-03 14:48:08 UTC
Severity:
important
Tags:
#558989#5
Date:
2009-12-01 02:13:44 UTC
From:
To:
Dash should not implement -nt at all if it wants to be strict about
things that aren't POSIX.  If it is going to implement non standard
things from other sources, then it absolutely should not be inventing
entirely new behaviours for them from whole cloth, let alone completely
reversing the logic of existing long established code.

Doing that could easily introduce any of the scenarios defined for a
'critical' bug, but I don't want to get all handwavy about the severity,
I just think this is an RC issue that should be fixed for squeeze (but
it's not really a -policy thing else I'd have probably just made it
'serious').

$ bash
$ test "/bin/ls" -nt "no-such-file" || echo "oh ffs :("
$ /usr/bin/test "/bin/ls" -nt "no-such-file" || echo "oh ffs :("
$ dash
$ test "/bin/ls" -nt "no-such-file" || echo "oh ffs :("
oh ffs :(

Now imagine that's checking something important to the integrity of
the system ...

Please fix this.  Even if it's just to remove -nt entirely and have
such scripts _obviously_ break rather than silently doing the exact
opposite of what they always have in the past.  People who've had
systems running Debian for years deserve more from us than this.

Thanks,
Ron

#558989#10
Date:
2009-12-05 15:49:19 UTC
From:
To:
#558989#17
Date:
2009-12-19 14:16:39 UTC
From:
To:
Package: dash
Followup-For: Bug #558989
doesn't invent entirely new behaviour.  Dash does the same as the BSD test program.
originally,  I guess this behaviour comes from the original netbsd ash.
idea to remove this Non POSIX feature.> Just want to point out: though dash's
builtin test differs from bash's,  dash doesn't invent entirely new behaviour.  Dash
does the same as the BSD test program.
originally,  I guess this behaviour comes from the original netbsd ash.

#558989#22
Date:
2010-02-20 13:30:49 UTC
From:
To:
Hello,

This is probably just an oversight, but it does not; this part:

+               (stat (f2, &b2) != 0 &&
+                b1.st_mtime < b2.st_mtime));

should in fact be

+               (stat (f2, &b2) != 0 ||
+                b1.st_mtime < b2.st_mtime));

Also, stat can fail in other cases than a nonexistent file (eg. EACCESS	) which should be taken care of...

Regards
    Jiri Palecek

#558989#27
Date:
2010-02-20 13:09:54 UTC
From:
To:
tag 558989 - patch
thanks

Hi Jiri,

Oops, you're right.  Thanks for catching that.  Unfortunately, that's
not sufficient to make dash match the Korn shell documentation (e.g.,
if file2 exists but file1 does not).

While creating a patch to make it do so isn't difficult, I'm not sure
which behavior is desired, so I'm removing the patch tag until that's
decided.

#558989#34
Date:
2010-02-21 12:39:46 UTC
From:
To:
The revised patch exactly matches the current practice of the
test builtins in ksh93 (where it was introduced), bash, and the
test utility in the GNU coreutils.

Whether to patch it like this is another question, I think this
should be discussed upstream, see
http://www.mail-archive.com/dash@vger.kernel.org/msg00206.html

#558989#39
Date:
2010-03-19 15:11:46 UTC
From:
To:
severity 558989 important
tags 558989 + wontfix
quit

Hi, here's upstream's opinion on this
http://www.mail-archive.com/dash@vger.kernel.org/msg00208.html

I don't think we should make a Debian-specific change for that, hence I
mark the bug wontfix.

Thanks, Gerrit.

#558989#48
Date:
2010-03-21 15:14:56 UTC
From:
To:
Hi Gerrit, Herbert,

I can sympathise with you not wanting to fork this from upstream (thus
opening a window for ever greater lulz), but if I accept the validity of
Herbert's argument - that this is a BSD shell, with longstanding and
documented behaviour - as a reason not to change this, then doesn't the
very same reasoning at least equally apply to silently changing the
behaviour of the Debian default bin/sh?

He does also say though, that "existing features are not removed unless
there is a very good reason".  Does widely adopting this as a distro
default shell, by a growing number of distros, not count here as a
"very good reason"?

Herbert, could we at least make this optional, so it could be disabled
at compile time?  Or perhaps better, have it disabled when it is called
as /bin/sh, leaving dash still compatible for people already calling it
specifically as that?

Cheers,
Ron


[ I do still consider this an RC issue for Debian, I wouldn't be happy
  releasing squeeze with a surprise like this in it for existing long
  time users.  But I'll save speculation on other options until we get
  some ack or nack from Herbert on the above.  They're surely among
  the easiest options I can see, and if all distros are going this way
  we're not going to be the only ones wanting some solution to it. ]

#558989#55
Date:
2025-01-03 14:44:17 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
dash, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 558989@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andrej Shadura <andrewsh@debian.org> (supplier of updated dash package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Fri, 03 Jan 2025 15:13:44 +0100
Source: dash
Architecture: source
Version: 0.5.12-10
Distribution: unstable
Urgency: medium
Maintainer: Andrej Shadura <andrewsh@debian.org>
Changed-By: Andrej Shadura <andrewsh@debian.org>
Closes: 558989 1078130
Changes:
 dash (0.5.12-10) unstable; urgency=medium
 .
   [ Dominik Viererbe ]
   * d/t/mmdebstrap: remove unused parsing of distribution from changelog
   * Incorporate Ubuntu DEP-17 /usr merge changes:
     [ Julian Andres Klode ]
     - debian/shells.d/dash: move files to /usr
     - debian/tests/smoke: add /bin/dash link tests
 .
   [ Helmut Grohne ]
   * Warn the user if /bin/sh is ineffectively diverted (DEP-17)
     (Closes: #1078130)
 .
   [ Andrej Shadura ]
   * Apply upstream patch to align test -nt and -ot with POSIX.1-2024
     (Closes: #558989)
   * Apply upstream patch to fix here-doc handling.
   * Add Belarusian and Slovak translations for debconf templates.
Checksums-Sha1:
 89bf42985df09954abf43d78a043d253498b0028 1460 dash_0.5.12-10.dsc
 b2f117b69223c79ffddda2d25001859b0d6accac 43144 dash_0.5.12-10.debian.tar.xz
Checksums-Sha256:
 10b41615e100781d12df4a023299b3df11485947cf83b2f4bc5935f850205673 1460 dash_0.5.12-10.dsc
 9665d374c5da6730f39d617f0aadc58466cd198ccf95e818eba6f17a570c24ff 43144 dash_0.5.12-10.debian.tar.xz
Files:
 d6093266eec74639eaba8f27f36befc4 1460 shells optional dash_0.5.12-10.dsc
 a9a853fea75f530c236761b324104eaf 43144 shells optional dash_0.5.12-10.debian.tar.xz
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQSD3NF/RLIsyDZW7aHoRGtKyMdyYQUCZ3fxDQAKCRDoRGtKyMdy
YT8fAQDlM11N3nx53G1j+A1IfbVOM8uW/3Zo1dl7XEkOSUm5UAD/TAbrdCOFKoIk
LIOuhoTRf3f3uwB8zcF80Np34QeZ3As=
=Ip+n
-----END PGP SIGNATURE-----