[Top][All Lists]

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

Re: tar does not support partial reads

From: Paul Eggert
Subject: Re: tar does not support partial reads
Date: Mon, 19 Jul 2021 15:39:53 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 7/19/21 7:54 AM, Christian Schoenebeck wrote:
POSIX compliant applications must always expect that read() /
write() functions might read/write less bytes than requested

Although that's true in general, it's not true for regular files. The POSIX spec for 'read' <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html> says, "The value returned may be less than /nbyte/ if the number of bytes left in the file is less than /nbyte/, if the /read/() request was interrupted by a signal, or if the file is a pipe or FIFO or special file and has fewer than /nbyte/ bytes immediately available for reading."

So, regular files shouldn't get short reads unless there's an EOF or a signal.

Perhaps someone could hack on GNU Tar to make it more robust in the presence of filesystems that fail to conform to POSIX. Regardless of that, though, your filesystem should get fixed, as lots of programs other than GNU Tar assume POSIX semantics for regular files.

reply via email to

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