[Top][All Lists]

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

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

From: Pádraig Brady
Subject: Re: Bug#467378: coreutils: Please include a program to truncate files
Date: Mon, 25 Feb 2008 10:29:10 +0000
User-agent: Thunderbird (X11/20071008)

Jim Meyering wrote:
> Russell Coker <address@hidden> 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 longer than the old length then
>> it would either write zeros to the end or extend the file (with a hole)
>> via the truncate() system call according to the wish of the user.  If the new
>> length is shorter then it would just call truncate().
>> 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.
> That would be nice.
> If the mythical miscutils project were more concrete,
> I'd say this tool belongs there.

I'm planning to push code to this very "project" very soon.
As previously discussed I'm going to push this to
the misc-utils directory of the util-linux-ng project.
We can split that directory as a new project in future
if ever deemed necessary.

> I'm not 100% sure it should be written in C, especially
> since I wrote it in Perl:

And here's a shell version:
I'm probably going to (re)write all "miscutils" in C though.

> Russell, if you want to write a C version and do the usual
> complete job (update coreutils.texi, NEWS, etc. and add tests),
> I'd probably go for it.  The only reason not to would be if
> miscutils is now viable, and even then...
> One advantage of using C/coreutils/gnulib
> is that you'd get k, M, G, ... byte-count suffixes for free.

Note I already got util-linux-ng using the "coreutils" suffixes,
so this should be a good fit.

Russell if you want to push code to me it's fine,
but I was going to work on this tool anyway.


reply via email to

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