GNU bug report logs - #23227
Inconsistent behavior for --file=~/some-file

Previous Next

Package: grep;

Reported by: Santiago Ruano Rincón <santiagorr <at> riseup.net>

Date: Tue, 5 Apr 2016 21:56:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #18 received at 23227 <at> debbugs.gnu.org (full text, mbox):

From: Santiago Ruano Rincón <santiagorr <at> riseup.net>
To: Eric Blake <eblake <at> redhat.com>, 504804-done <at> bugs.debian.org
Cc: 23227 <at> debbugs.gnu.org
Subject: Re: bug#23227: Inconsistent behavior for --file=~/some-file
Date: Wed, 6 Apr 2016 10:10:35 +0200
El 05/04/16 a las 16:14, Eric Blake escribió:
> On 04/05/2016 04:03 PM, Eric Blake wrote:
> > Tilde expansion in the shell is defined by POSIX to only happen if ~
> > occurs as the first character of a word
> 
> > 
> > Since this behavior is baked into your shell, there's nothing grep can
> > do about it, so I'm closing this as not a bug.
> 
> And before you argue that "surely grep could be taught to treat
> "--file=~/..." as a request to perform tilde expansion itself, since the
> shell didn't", you'd have to patch the same problem in EVERY OTHER
> program that has long options, AND you'd have an ambiguity for:
> 
> --file '~/...' # I want a literal tilde, not shell tilde expansion
> 
> That is, grep doing tilde expansion in addition to the shell could cause
> places where you get improper expansion in spite of intentionally using
> shell quoting to avoid tilde expansion.  Besides, tilde expansion in
> general is NOT trivial to reimplement (while ~ vs. $HOME is easy,
> ~username is not - don't believe me? Look at how many lines of code bash
> uses to implement it), and it's not worth bloating every other
> application to redo expansion when we can already require the shell to
> do it for us.  You just have to learn to use the shell correctly so that
> expansion happens where you want it.
> 

Ok, you're right! Thanks for your answer, and I'm closing this bug in
Debian.

Cheers,

Santiago




This bug report was last modified 9 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.