Re: [PATCH] libbb: More informative "short write" error

2016-09-13 Thread Bernhard Reutner-Fischer
On September 12, 2016 7:35:24 PM GMT+02:00, Denys Vlasenko 
 wrote:

>Current git:
>
>$ ./busybox wget -O /dev/full google.com
>Connecting to google.com (74.125.196.138:80)
>Connecting to www.google.cz (74.125.196.94:80)
>wget: write error: No space left on device

Perfect.
thanks,

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-12 Thread Denys Vlasenko
On Tue, Sep 6, 2016 at 8:17 AM, Bernhard Reutner-Fischer
 wrote:
> On 6 September 2016 at 08:08, Tito  wrote:
>
>> Hi,
>> I haven't time to test it now, but what would the message
>> be if not even a byte could be written to the device with
>> no space left?
>> I suspect it would be the same message.
>
> $ busybox wget -O /dev/full google.com
> Connecting to google.com (172.217.21.174:80)
> Connecting to www.google.at (172.217.21.163:80)
> wget: short write

Current git:

$ ./busybox wget -O /dev/full google.com
Connecting to google.com (74.125.196.138:80)
Connecting to www.google.cz (74.125.196.94:80)
wget: write error: No space left on device
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Bernhard Reutner-Fischer
On 6 September 2016 at 08:08, Tito  wrote:

> Hi,
> I haven't time to test it now, but what would the message
> be if not even a byte could be written to the device with
> no space left?
> I suspect it would be the same message.

$ busybox wget -O /dev/full google.com
Connecting to google.com (172.217.21.174:80)
Connecting to www.google.at (172.217.21.163:80)
wget: short write
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Tito



On 09/05/2016 11:30 PM, Denys Vlasenko wrote:

On Mon, Sep 5, 2016 at 10:46 PM, Tito  wrote:

On 09/05/2016 06:49 PM, Lauri Kasanen wrote:


On Mon, Sep 5, 2016, at 13:18, Denys Vlasenko wrote:


How about just replacing bb_error_msg_and_die()
with bb_perror_msg_and_die()?



$ busybox wget google.com
Connecting to google.com (172.217.20.14:80)
Connecting to www.google.fi (80.239.229.245:80)


Hi,
isn't "short write" redundant?


No, it is not: it says that some bytes were written.
As opposed to the situation when no bytes were written,
error happened right away.


Hi,
I haven't time to test it now, but what would the message
be if not even a byte could be written to the device with
no space left?
I suspect it would be the same message.
Ciao,
Tito
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Laurent Bercot

On 06/09/2016 04:04, Kang-Che Sung wrote:

Um, excuse me, but may I suggest a more informative message than "short write"?
"Short write" is a little bit unclear.


 "Short write" is the standard technical denomination for that issue;
using another term would be confusing.

--
 Laurent

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Kang-Che Sung
On Tue, Sep 6, 2016 at 5:30 AM, Denys Vlasenko  wrote:
> On Mon, Sep 5, 2016 at 10:46 PM, Tito  wrote:
>>
>> Hi,
>> isn't "short write" redundant?
>
> No, it is not: it says that some bytes were written.
> As opposed to the situation when no bytes were written,
> error happened right away.

Um, excuse me, but may I suggest a more informative message than "short write"?
"Short write" is a little bit unclear.

How about saying "data partially written"?
Or "partial data" or "partially done" for short.

Thank you.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Denys Vlasenko
On Mon, Sep 5, 2016 at 10:46 PM, Tito  wrote:
> On 09/05/2016 06:49 PM, Lauri Kasanen wrote:
>>
>> On Mon, Sep 5, 2016, at 13:18, Denys Vlasenko wrote:
>>>
>>> How about just replacing bb_error_msg_and_die()
>>> with bb_perror_msg_and_die()?
>>
>>
>> $ busybox wget google.com
>> Connecting to google.com (172.217.20.14:80)
>> Connecting to www.google.fi (80.239.229.245:80)
>
> Hi,
> isn't "short write" redundant?

No, it is not: it says that some bytes were written.
As opposed to the situation when no bytes were written,
error happened right away.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Tito



On 09/05/2016 06:49 PM, Lauri Kasanen wrote:

On Mon, Sep 5, 2016, at 13:18, Denys Vlasenko wrote:

How about just replacing bb_error_msg_and_die()
with bb_perror_msg_and_die()?


$ busybox wget google.com
Connecting to google.com (172.217.20.14:80)
Connecting to www.google.fi (80.239.229.245:80)

Hi,
isn't "short write" redundant?


wget: short write: No space left on device


maybe better to use just the function name or only the strerror?

Ciao,
Tito


Works, thanks.

- Lauri


___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Lauri Kasanen
On Mon, Sep 5, 2016, at 13:18, Denys Vlasenko wrote:
> How about just replacing bb_error_msg_and_die()
> with bb_perror_msg_and_die()?

$ busybox wget google.com
Connecting to google.com (172.217.20.14:80)
Connecting to www.google.fi (80.239.229.245:80)
wget: short write: No space left on device

Works, thanks.

- Lauri

-- 
http://www.fastmail.com - Send your email first class

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-05 Thread Denys Vlasenko
On Sun, Sep 4, 2016 at 12:11 PM, Lauri Kasanen  wrote:
> Hi,
>
> Over at TinyCore, we receive a huge number of questions of the type "I
> got "short write", what does it mean?". Mostly for the rpi port and when
> using bb wget. The attached patch makes the message more informative,
> and hopefully lets more people know what's up without having to ask.

 ssize_t size = full_write(fd, buf, count);
 if ((size_t)size != count)
-bb_error_msg_and_die("short write");
+bb_error_msg_and_die("short write, out of disk space?");

Well, it is "disk full" only for regular files.
For pipes or network, it's "we wrote some and then pipe was closed
before we wrote out everything". For devices, it's whole slew of
possibilities.

I looked at full_write() and it can return short write
only if write syscall failed. So errno must be set.

How about just replacing bb_error_msg_and_die()
with bb_perror_msg_and_die()?
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] libbb: More informative "short write" error

2016-09-04 Thread Laurent Bercot

On 04/09/2016 12:11, Lauri Kasanen wrote:

Over at TinyCore, we receive a huge number of questions of the type "I
got "short write", what does it mean?". Mostly for the rpi port and when
using bb wget. The attached patch makes the message more informative,
and hopefully lets more people know what's up without having to ask.


 I think a better fix would be to have a version of bb_verror_msg()
(which is called by bb_error_msg_and_die) that adds strerror(errno)
to the printed message. This way, the information given would always
match the actual error that happens.

 Of course, it's more invasive. But bb_verror_msg() deserves to
be rewritten anyway: it performs a lot of operations that can fail,
including allocating heap memory - you don't want that on an
abnormal exit path.

--
 Laurent

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[PATCH] libbb: More informative "short write" error

2016-09-04 Thread Lauri Kasanen
Hi,

Over at TinyCore, we receive a huge number of questions of the type "I
got "short write", what does it mean?". Mostly for the rpi port and when
using bb wget. The attached patch makes the message more informative,
and hopefully lets more people know what's up without having to ask.

- Lauri

-- 
http://www.fastmail.com - A no graphics, no pop-ups email service

From 5c9f3c91db1e8f5b7adb7fb8211ece92a5ecc756 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen 
Date: Sun, 4 Sep 2016 13:08:59 +0300
Subject: [PATCH] libbb: More informative "short write" error

Signed-off-by: Lauri Kasanen 
---
 libbb/xfuncs_printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index e9222f6..101836e 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -236,7 +236,7 @@ void FAST_FUNC xwrite(int fd, const void *buf, size_t count)
if (count) {
ssize_t size = full_write(fd, buf, count);
if ((size_t)size != count)
-   bb_error_msg_and_die("short write");
+   bb_error_msg_and_die("short write, out of disk space?");
}
 }
 void FAST_FUNC xwrite_str(int fd, const char *str)
-- 
2.6.2

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox