Bug#467378: coreutils: Please include a program to truncate files

2008-03-26 Thread Pádraig Brady
Proposed truncate command attached From 34b9bc72ffe70ec83710b12021e889d5ae65e508 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= [EMAIL PROTECTED] Date: Wed, 26 Mar 2008 14:03:31 + Subject: [PATCH] Add new program: truncate * AUTHORS: Register as the author. * NEWS: Mention

Bug#467378: coreutils: Please include a program to truncate files

2008-03-26 Thread Jim Meyering
Pádraig Brady [EMAIL PROTECTED] wrote: Subject: [PATCH] Add new program: truncate Nice! Thanks for doing all that. Here's a first pass: - fix a typo s/tound/round/ : [EMAIL PROTECTED] = tound up to multiple of - please indent using only spaces (no TABs) and add this at the end of

Bug#467378: coreutils: Please include a program to truncate files

2008-02-26 Thread Jim Meyering
Paul Eggert [EMAIL PROTECTED] wrote: Jim Meyering [EMAIL PROTECTED] writes: If you don't mind truncating first, how about this? true /var/spool/whatever/foo dd bs=1 seek=2G of=/var/spool/whatever/foo /dev/null Also, the latter command works even if the former command is omitted.

Bug#467378: coreutils: Please include a program to truncate files

2008-02-26 Thread Pádraig Brady
Jim Meyering wrote: Paul Eggert [EMAIL PROTECTED] wrote: Jim Meyering [EMAIL PROTECTED] writes: If you don't mind truncating first, how about this? true /var/spool/whatever/foo dd bs=1 seek=2G of=/var/spool/whatever/foo /dev/null Also, the latter command works even if the former

Bug#467378: coreutils: Please include a program to truncate files

2008-02-26 Thread Pádraig Brady
Russell Coker wrote: On Tuesday 26 February 2008 21:03, Pádraig Brady [EMAIL PROTECTED] wrote: That depends on your definition of works. If you don't mind retaining the first 2GiB of content in a preexisting output file, then it works fine. But the initial truncation is required if you want

Bug#467378: coreutils: Please include a program to truncate files

2008-02-26 Thread Russell Coker
On Tuesday 26 February 2008 21:03, Pádraig Brady [EMAIL PROTECTED] wrote: That depends on your definition of works. If you don't mind retaining the first 2GiB of content in a preexisting output file, then it works fine. But the initial truncation is required if you want to be sure it's a

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Pádraig Brady
Jim Meyering wrote: Russell Coker [EMAIL PROTECTED] wrote: If I have a file that is 2G in size but wish to discard the last 1G of data then there seems to be no program available to do this. I think it would be ideal to have a program as part of coreutils that allows you to resize a file.

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Bob Proulx
Russell Coker wrote: Bob Proulx wrote: There is always 'head'. head --bytes=1024m That doesn't do what I want at all. I knew you wouldn't be happy with it. :-) I did mention that it copied the data twice for example. But it was an obvious program to mention because it could be used

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Jim Meyering
Russell Coker [EMAIL PROTECTED] wrote: On Monday 25 February 2008 21:29, Pádraig Brady [EMAIL PROTECTED] wrote: Russell if you want to push code to me it's fine, but I was going to work on this tool anyway. I don't have any code (yet). If you are going to work on it then I would be more

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Russell Coker
On Monday 25 February 2008 21:29, Pádraig Brady [EMAIL PROTECTED] wrote: Russell if you want to push code to me it's fine, but I was going to work on this tool anyway. I don't have any code (yet). If you are going to work on it then I would be more than happy to leave it to you. I would be

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Michael Stone
On Mon, Feb 25, 2008 at 11:28:41AM +1100, Russell Coker wrote: I would be happy to contribute the code for this. This will require some discussion with upstream, but it seemed best to start the discussion here. No, I'd start it upstream and try to solicit input from a wider base than the

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Russell Coker
On Monday 25 February 2008 22:11, Jim Meyering [EMAIL PROTECTED] wrote: One non-obvious feature request that I have is for a truncate on a non-existant file to create it (similar to the way touch is commonly used to create files). The obvious question is then Why? One specific case is

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Jim Meyering
Russell Coker [EMAIL PROTECTED] wrote: On Monday 25 February 2008 22:11, Jim Meyering [EMAIL PROTECTED] wrote: One non-obvious feature request that I have is for a truncate on a non-existant file to create it (similar to the way touch is commonly used to create files). The obvious

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Paul Eggert
Jim Meyering [EMAIL PROTECTED] writes: If you don't mind truncating first, how about this? true /var/spool/whatever/foo dd bs=1 seek=2G of=/var/spool/whatever/foo /dev/null Also, the latter command works even if the former command is omitted. That is, by itself, that invocation of

Bug#467378: coreutils: Please include a program to truncate files

2008-02-25 Thread Russell Coker
On Tuesday 26 February 2008 10:08, Paul Eggert [EMAIL PROTECTED] wrote: dd bs=1 seek=2G of=/var/spool/whatever/foo /dev/null Also, the latter command works even if the former command is omitted. That is, by itself, that invocation of dd resizes /var/spool/whatever/foo to 2 GiB,

Bug#467378: coreutils: Please include a program to truncate files

2008-02-24 Thread Russell Coker
Package: coreutils Version: 5.97-5.3 Severity: wishlist If I have a file that is 2G in size but wish to discard the last 1G of data then there seems to be no program available to do this. I think it would be ideal to have a program as part of coreutils that allows you to resize a file. If the

Bug#467378: coreutils: Please include a program to truncate files

2008-02-24 Thread Bob Proulx
Russell Coker wrote: If I have a file that is 2G in size but wish to discard the last 1G of data then there seems to be no program available to do this. There is always 'head'. head --bytes=1024m But that does still perform 1G x 2 of I/O. Let me guess. You have a partially downloaded

Bug#467378: coreutils: Please include a program to truncate files

2008-02-24 Thread Russell Coker
On Monday 25 February 2008 12:26, Bob Proulx [EMAIL PROTECTED] wrote: There is always 'head'. head --bytes=1024m That doesn't do what I want at all. It creates a new file, which is an entirely different thing, it uses temporary file space (in the above example it won't work unless there

Bug#467378: coreutils: Please include a program to truncate files

2008-02-24 Thread Jim Meyering
Russell Coker [EMAIL PROTECTED] wrote: If I have a file that is 2G in size but wish to discard the last 1G of data then there seems to be no program available to do this. I think it would be ideal to have a program as part of coreutils that allows you to resize a file. If the new length is