GNU bug report logs - #6268
Suggestion: truncate should allow -r and -s options together

Previous Next

Package: coreutils;

Reported by: "Richard W.M. Jones" <rjones <at> redhat.com>

Date: Tue, 25 May 2010 15:42:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Voelker, Bernhard" <bernhard.voelker <at> siemens-enterprise.com>
Cc: 6268 <at> debbugs.gnu.org
Subject: Re: bug#6268: Suggestion: truncate should allow -r and -s options
	together
Date: Mon, 31 May 2010 09:50:44 +0100
On 31/05/10 07:31, Voelker, Bernhard wrote:
> Pádraig Brady wrote:
>> Jim Meyering wrote:
>>> what about --ref=non-regular-file ?
> 
>> Yes that's safer. st_size is only defined for regular files
>> (or shared mem), so I'll only allow regular files.
>> I'll push a separate patch soon.
> 
> what about --ref=- ?
> 
> one wants to have a file with the size
> of a partition plus 5G, e.g.
> 	truncate --ref=/dev/sda5 -s +5G myfile
> This will fail and will be rejected with such a patch.
> So the user could use:
> 	truncate --ref=- -s +5G myfile < /dev/sda5
> 
> Just a thought ...

Well we never supported referencing stdin as
we stat() the name. Also one needs to use a separate
operation to get the size of a block device,
so before the patch we just returned 0 which was invalid.

I wrote a comment in the code to say referencing
the size of a block device is probably useful,
but we'll need to worry about portability of that.

cheers,
Pádraig.




This bug report was last modified 14 years and 359 days ago.

Previous Next


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