6

The shasum utility has a a -p/--portable option with the following description:

-p, --portable     read files in portable mode
                   produces same digest on Windows/Unix/Mac

I've never seen the inclusion this option change the digest of a file, and I'm not really sure what effect it's supposed to have either. What is this "portable mode" of reading files?

5
  • 1
    Takes in account different EOL characters?
    – DavidPostill
    Feb 19, 2017 at 14:08
  • 1
    @DavidPostill Maybe, though that'd be strange too. Different EOLs makes for different files, and thus they should have different digests, right? The platforms's EOLs doesn't seem like something shasum should try to interpret/coerce
    – Flambino
    Feb 19, 2017 at 14:17
  • For what it's worth shasum says " -p, --portable read in portable mode (to be deprecated)
    – DavidPostill
    Feb 19, 2017 at 14:24
  • @DavidPostill Ah, didn't say that in my manpage for it. Only makes it more mysterious :)
    – Flambino
    Feb 19, 2017 at 14:25
  • 1
    Answer added ;)
    – DavidPostill
    Feb 19, 2017 at 14:37

1 Answer 1

5

What is this "portable mode" of reading files?

For what it's worth shasum says:

-p, --portable read in portable mode (to be deprecated)

As far as I can tell (I am no perl expert) it appears to be there to take into account different EOL characters.

The source code says:

The sums are computed as described in FIPS PUB 180-2.  When checking, the
input should be a former output of this program.  The default mode is to
print a line with checksum, a character indicating type (`*' for binary,
`?' for portable, ` ' for text), and name for each FILE.

...

# Try to figure out if the OS is DOS-like.  If it is,
    # default to binary mode when reading files, unless
    # explicitly overriden by command line "--text" or
    # "--portable" options.

...

I'm happy for any perl experts to look at the complete source code and confirm my answer.

1
  • well, darn. Your hunch was right - still a strange feature, but alright. I'll wait a bit and see if anyone else has something to add, but I suspect the checkmark's yours
    – Flambino
    Feb 19, 2017 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .