[bug] printing zero size files

walter harms wharms at bfs.de
Sat Apr 28 09:49:07 UTC 2012



Am 28.04.2012 10:58, schrieb Denys Vlasenko:
> On Fri, Apr 27, 2012 at 3:25 PM, walter harms <wharms at bfs.de> wrote:
>>>>>>>  touch null
>>>>>>>  lpr null <- never returns
>>>>>>
>>>>>> Can't reproduce.
>>>>>>
>>>>>> Please strace it.
>>>>>
>>>>> Hello Denis,
>>>>> can you reproduce it using  "lpr -Plp at remote null" ?
>>>>>
>>>>> from strace:
>>>>> ...
>>>>> read(3, "\0", 1)                        = 1
>>>>> write(3, "\0", 1)                       = 1
>>>>> read(3, 0x7ffff39a19b0, 1)              = ? ERESTARTSYS (To be restarted)   <!-- last before SIGINT ->
> 
> BTW, can you send a larger strace log fragment?
> 
>>> It looks ok. We sent zero bytes of the file,
>>> then sent NUL byte as end-of-file indicator,
>>> and we wait for remote host to ACK or NAK it.
>>>
>>>> When i add a file size check it seems to work.
>>>>
>>>> the problem is located here:
>>>> static void get_response_or_say_and_die(int fd, const char *errmsg)
>>>> {
>>>>        ssize_t sz;
>>>>        char buf[128];
>>>>
>>>>        buf[0] = ' ';
>>>>        sz = safe_read(fd, buf, 1);  <-- never returns
>>>>
>>>> i do not know the lpr specs but i guess a file size of 0 is not permitted.
>>>
>>> I didn't find any such restriction. Zero byte file is ok
>>> (it does not make much sense, but is valid).
>>>
>>> I think you lpd server is just buggy.
>>
>> would it hurt to prevent zero sized files to be send ?
>> at least the lpr version i tested reject zero size files.
> 
> It does not reject them. It simply does not send ANY response,
> positive or negative. This looks like a bug.
> 
> What next, reject print jobs which contain only whitespace?
> 
>> lpr zero  (CUPS version)
>> lpr: No file!?!
> 
> Can you send a strace log of this command?
> 

log attached


re,
 wh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xx.gz
Type: application/x-gzip
Size: 5127 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20120428/27151ec9/attachment.bin>


More information about the busybox mailing list