[PATCH] function bb_askpass only read one line once

Denys Vlasenko vda.linux at googlemail.com
Mon Feb 1 13:18:05 UTC 2010


On Mon, Feb 1, 2010 at 10:13 AM, Michael Zhu <linuxsir320 at gmail.com> wrote:
> Reading is terminated when encountering '\r', but DOS file format ends with
> newline '\r\n'.
> I wan to get the next line, so '\n' is dropped. I known this modification is
> not better, but
> I could not find a better way. How about this: saving the character read,
> when reading next
> time, if character is '\n', and last character just saved is '\r', skipping
> it and going on. Maybe
> it's not necessary.

It's quite unlikely that busybox will be used with DOS-style
files being piped to passwd. If you really need to, dos2unix
can help, no need to bloat every applet with DOS support code:

$ echo -ne "qwe\r\nrty\r\n" | hexdump -C
00000000  71 77 65 0d 0a 72 74 79  0d 0a                    |qwe..rty..|
0000000a

$ echo -ne "qwe\r\nrty\r\n" | dos2unix | hexdump -C
00000000  71 77 65 0a 72 74 79 0a                           |qwe.rty.|
00000008


The fix is in git now, please let me know if it doesn't work.
--
vda


More information about the busybox mailing list