On Wed, Sep 25, 2013 at 5:59 PM, Glenn Fowler <g...@research.att.com> wrote:
>
> On Wed, 25 Sep 2013 17:01:06 +0200 Irek Szczesniak wrote:
>> On Wed, Sep 25, 2013 at 2:49 PM, Glenn Fowler <g...@research.att.com> wrote:
>> >
>> > this is just a general comment on those contemplating adding
>> > #ifdef to select option visibility based on the underlying system
>
>> Is this about md5sum(1)? AFAIK the *defaults* are platform-specific,
>> based on what Windows does, but not the availability of the options.
>> Or is this something different?
>
> md5sum triggered the comment
> but there are / have been other patches in the queue that do similar this
> libcmd::sync(1) and ksh93::cd(1) -@ come to mind
> I wanted to nip it in the bud so it doesn't become a habit
>
> now re md5sum
>
> the gnu docs are fouled up because they don't match gnu-ish reality on cygwin
> cygwin actually gets it right by making --binary the default
> but that leads to
>         gnu-md5sum *.tgz > gnu-output
> run on linux and cygwin, for the same set of files, producing different 
> results
> the md5sum (should) match but the cygwin output will have the '*' indicator
>
> suppose, for the same set of *.tgz you do this on cygwin
>         gnu-md5sum *.tgz > cygwin-output
> and this on linux
>         gnu-md5sum *.tgz > linux-output
> on cygwin this will fail
>         gnu-md5sum --check linux-output
> at least on linux this will work
>         gnu-md5sum --check cygwin-output
>
> the *ast* --binary default is not platform specific because it is consistent
> across unix and _WINIX and honors the principle of least surprise
> so this
>         ast-md5sum *.tgz > ast-output
> and this
>         ast-md5sum --check ast-output
> will work no matter what platform either command is executed on
>
> the next alpha, probably later today to fix the ASTAPI() build problem, will
> have libcmd::cksum(1) and libsum fixed to generate and consume the ' ' and '*'
> read mode indicators -- the only thing will be that on all systems by default
> ast md5sum will print the '*' indicator

Why do you want to do that?

On *LINUX* and Solaris 10 with /usr/gnu/bin/mdsum I get this:
/usr/bin/md5sum /usr/bin/md5sum
85e85dcf910f4c5d1dd1729b2c81e584  /usr/bin/md5sum
/usr/bin/md5sum --binary /usr/bin/md5sum
85e85dcf910f4c5d1dd1729b2c81e584 */usr/bin/md5sum

This happens because --text and --binary are identical on Linux and Solaris.
> -- lets see how many gnu-reliant scripts
> blow up due to that -- this is one of those things that if you demand gnu
> semantics on one side prepare to handle them on the other

... nothing to say here. I am not sure whether it is a good idea to
serve us that mess GNU coreutils caused and force us to eat it, too.

There may be a 3rd option:
Use three states:
1. If --binary is given print " *"
2. If --text is given print "  :
3. On UNIX/Linux default to "  " if no option is given, and default to
--text on Windows

Irek
_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to