#40 rhash mistakes disk file named "-" for stdin

None
closed-fixed
nobody
None
5
2014-01-10
2013-09-21
Liviu
No

Running rhash v1.3.0 stock win32 build under xp sp3.

A file or directory name of "-" is mistaken for "stdin" even if it's quoted, or part of a wildcard such as "*.*", and even if the wildcard comes after "--".


C:\tmp>dir /a-d *.
02/09/2013 08:26 PM 15 -
02/09/2013 08:26 PM 15 --

C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- -
18:00.00 1969-12-31 0 -

C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "-"
18:00.00 1969-12-31 0 -

C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "-."
19:26.15 2013-02-09 15 -.

C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "*."
18:00.00 1969-12-31 0 -
19:26.15 2013-02-09 15 --

C:\tmp>


Liviu

Discussion

  • Liviu
    Liviu
    2013-09-21

    P.S. Sorry, not versed in this forum's syntax subtleties... The latter of what got posted as "or part of a wildcard such as "."" was meant as "star.star" where "star" is the usual DOS wildcard.

     
  • Aleksey
    Aleksey
    2013-09-27

    This is known behaviour, which can be 'fixed' only on Windows platform.

    There is a workaround: supply to the program a wildcard with a path, e.g.

    rhash-1.3.0.exe --printf="%{mtime}\t%s\t%f\n" .*

     
  • Liviu
    Liviu
    2013-09-27

    At the risk of sounding biased and self-interested ;-) but fixing it, even if only for Windows, could be worth considering.

    The current behavior may well be known, but it's not documented nor obvious, and sure to catch unsuspecting Windows users by surprise.

    For single files, supplying the full path e.g. "C:\tmp\-" is sufficient as a workaround. But, the workaround fails with "-r" directory recursion, and so does "C:\tmp\-.*" for example (however both "C:\tmp\*.* and ".\*.*" wildcards seem to work reliably - though of course they include all files rather than a targeted subset thereof).

    Thanks for the followup, and again for rhash itself.

     
  • Aleksey
    Aleksey
    2014-01-10

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,6 @@
     Running rhash v1.3.0 stock win32 build under xp sp3.
    
    -A file or directory name of "-" is mistaken for "stdin" even if it's quoted, or part of a wildcard such as "*.*", and even if the wildcard comes after "--".
    +A file or directory name of "-" is mistaken for "stdin" even if it's quoted, or part of a wildcard such as "\*.\*", and even if the wildcard comes after "--".
     ____
    
     C:\tmp>dir /a-d *.
    @@ -16,7 +16,7 @@
     C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "-."
     19:26.15 2013-02-09     15      -.
    
    -C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "*."
    +C:\tmp>rhash-1.3.0.exe --printf=%{mtime}\t%s\t%p\n -- "\*."
     18:00.00 1969-12-31     0       -
     19:26.15 2013-02-09     15      --
    
    • status: open --> closed-fixed
     
  • Aleksey
    Aleksey
    2014-01-10

    Fixed in RHash 1.3.1 only for Windows.

    Only a file explicitly specified as '-' on the command line will be interpreted as "stdin".