coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] md5sum: add an option to change directory


From: Bertrand Jacquin
Subject: Re: [PATCH] md5sum: add an option to change directory
Date: Sat, 30 May 2020 22:59:05 +0100
User-agent: All mail clients suck. This one just sucks less.

Hi,

On Wed, May 20, 2020 at 06:26:59PM -0700, Kaz Kylheku (Coreutils) wrote:
> On 2020-05-20 14:15, Bertrand Jacquin wrote:
> > In the fashion of make and git, add the ability for all sum tools to
> > change directory before reading a file.
> > 
> >   $ sha256sum /etc/fstab
> >   b5d6c0e5e6bc419b134478ad7b3e7c8cc628049876a7772cea469e81e4b0e0e5  
> > /etc/fstab
> 
> Make requires this option because it reads a Makefile, and those often
> contain relative references which assume that the Makefile's directory
> is current.
> 
> The inputs to md5sum don't don't contain path references that break.
> 
> In other regards, every tool that does anything with files could
> have a -C option:
> 
> Copying files:
> 
>      cp -C /etc fstab fstab.bak
> 
> Executing a script:
> 
>      sh -C /etc rc.local
> 
> Editing:
> 
>      vi -C /etc fstab
> 
> Where does it end?

This definitely make sense

> >   $ sha256sum -C /etc fstab
> >   b5d6c0e5e6bc419b134478ad7b3e7c8cc628049876a7772cea469e81e4b0e0e5  
> > fstab
> 
> The net effect is that just the output has changed to omit the path 
> name.
> 
> Maybe this wants to be a --strip or -p option like with diff or patch,
> or --basename-only to strip a variable number of components, leaving 
> only
> the last.

This seems to be a better approach indeed. I just sent a new patch using
base_name from coreutils itself.

Cheers,

-- 
Bertrand



reply via email to

[Prev in Thread] Current Thread [Next in Thread]