bug-coreutils
[Top][All Lists]
Advanced

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

Re: moot and unposixy error message


From: Benno Schulenberg
Subject: Re: moot and unposixy error message
Date: Tue, 19 Aug 2008 23:03:58 +0200
User-agent: KMail/1.9.9

Andreas Schwab wrote:
> But the sum can overflow, and since the involved types are
> unsigned this has defined (wrap-around) behaviour.

Thanks.  I felt I must be overlooking something, but couldn't figure 
out what.

> > Further, the Open Group says that 'od' should not produce an
> > error when '-j' plus '-N' is longer than the file, so the above
> > section can be removed.
>
> This is a good point, however.  But end_offset should then be set
> to (uintmax_t)-1 on overflow.

Setting end_offset to the largest possible integer upon overflow 
will probably do the right thing in all practical cases; but if the 
file is really longer than an integer can represent, it would then 
output the wrong number of bytes.  Better print an error message 
instead then.

$ od -j1 -N18446744073709551615 testfile
od: skip-bytes + read-bytes is too large

$ od -j1 -N18446744073709551616 testfile
od: -N argument `18446744073709551616' too large

$ od -j18446744073709551616 -N1 testfile
od: -j argument `18446744073709551616' too large

$ od -j18446744073709551615 -N1 testmail.k
od: skip-bytes + read-bytes is too large

Benno




reply via email to

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