Skip to content

interp: test -nt/-ot might not conform to POSIX 2024 #1340

Closed

Description

@q3cpma

Hello and first, sorry for the haphazard bug form, since Gentoo doesn't have a gosh package and I just looked at the source code. A small gander at https://github.com/mvdan/sh/blob/master/interp/test.go#L80 seems to imply that [ f1 -nt f2 ] (resp. for -ot) fails if f2 doesn't exist but POSIX sez

pathname1 -nt pathname2
True if pathname1 resolves to an existing file and pathname2 cannot be resolved, or if both resolve to existing files and pathname1 is newer than pathname2 according to their last data modification timestamps; otherwise, false.

Regards

Activity

  1. mvdan commented on Jun 2, 2026

    @mvdan
    Owner

    Thanks for spotting and reporting!

  2. added a commit that references this issue on Jun 3, 2026
    b0ee21e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址