Re: [Toybox] sed N at EOF

2022-09-12 Thread Rob Landley
On 9/12/22 10:33, enh wrote: > here's BSD sed on macOS: > > *~$ *echo one | /usr/bin/sed N > > *~$ *echo -e 'one\none\none' | /usr/bin/sed 'N;ax' > > sed: 1: "N;ax": command a expects \ followed by text > > *~$ * Yeah, being able to have the payload of "a" or "i" on the same line is a gnu exte

Re: [Toybox] sed N at EOF

2022-09-12 Thread enh via Toybox
here's BSD sed on macOS: *~$ *echo one | /usr/bin/sed N *~$ *echo -e 'one\none\none' | /usr/bin/sed 'N;ax' sed: 1: "N;ax": command a expects \ followed by text *~$ * On Mon, Sep 12, 2022 at 6:23 AM Rob Landley wrote: > Posix says the N command does NOT trigger the default print at EOF: > > h

[Toybox] sed N at EOF

2022-09-12 Thread Rob Landley
Posix says the N command does NOT trigger the default print at EOF: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html [2addr]N Append the next line of input, less its terminating , to the pattern space, using an embedded to separate the appended material from the origina

Re: [Toybox] sed

2019-11-11 Thread scsijon
On 11/11/19 12:13, Rob Landley wrote: On 11/10/19 6:56 PM, scsijon wrote: I know it's not exactly a toybox problem, but can someone please sort this out for me. sed ':a;N;$!ba;s|>\s*<|><|g' Could you please be a little more vague? I could have except I considered either you or one of those

Re: [Toybox] sed

2019-11-10 Thread Rob Landley
On 11/10/19 6:56 PM, scsijon wrote: > I know it's not exactly a toybox problem, but can someone please sort this out > for me. > > sed ':a;N;$!ba;s|>\s*<|><|g' Could you please be a little more vague? :a is a jump label N means read the next line of input and append it to this one. $! means m

[Toybox] sed

2019-11-10 Thread scsijon
I know it's not exactly a toybox problem, but can someone please sort this out for me. sed ':a;N;$!ba;s|>\s*<|><|g' ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net

[Toybox] sed "aci" test?

2019-01-11 Thread enh via Toybox
for me this just hangs with TEST_HOST=1 (maybe i'm not patient enough, but this is on a current Xeon!) and spews "sed: short write: Broken pipe" if i'm testing the toybox version. (as usual this is on recent-ish Debian.) ___ Toybox mailing list Toybox@li

Re: [Toybox] sed -i

2018-12-18 Thread enh via Toybox
thanks. i was ooo so i didn't get chance to check whether ';' would "just work"... On Sat, Dec 15, 2018 at 6:26 PM Rob Landley wrote: > > On 12/11/18 4:09 PM, enh via Toybox wrote: > > what's the right way to express an argument like sed's -iSUFFIX that takes > > an > > _optional_ string argum

Re: [Toybox] sed -i

2018-12-15 Thread Rob Landley
On 12/11/18 4:09 PM, enh via Toybox wrote: > what's the right way to express an argument like sed's -iSUFFIX that takes an > _optional_ string argument? right now i'm struggling to think of a similar > option to copy & paste from... https://github.com/landley/toybox/commit/eadbf601a0c9 Rob __

Re: [Toybox] sed -i

2018-12-11 Thread enh via Toybox
name filename" to work properly. And yes, I cared about both. > There's a > _reason_ it's not trying to use the libc optargs plumbing... > > I take it you have a script using the extension? yeah, there's a bunch of `-i.bak`. t

Re: [Toybox] sed -i

2018-12-11 Thread Rob Landley
On 12/11/18 5:34 PM, enh wrote: > Ah, I didn't actually check the code --- I saw that the docs mentioned --color > but they strongly imply that ; is *only* for long options. (Though what does > that mean for -i versus --in-place? Maybe I should just try it and see what > happens!) I very vaguely r

Re: [Toybox] sed -i

2018-12-11 Thread enh via Toybox
Ah, I didn't actually check the code --- I saw that the docs mentioned --color but they strongly imply that ; is *only* for long options. (Though what does that mean for -i versus --in-place? Maybe I should just try it and see what happens!) On Tue, Dec 11, 2018, 15:24 Rob Landley On 12/11/18 4:0

Re: [Toybox] sed -i

2018-12-11 Thread Rob Landley
On 12/11/18 4:09 PM, enh via Toybox wrote: > what's the right way to express an argument like sed's -iSUFFIX that takes an > _optional_ string argument? right now i'm struggling to think of a similar > option to copy & paste from... I'm not quite sure what you mean, but I implemented ; in lib/args

[Toybox] sed -i

2018-12-11 Thread enh via Toybox
what's the right way to express an argument like sed's -iSUFFIX that takes an _optional_ string argument? right now i'm struggling to think of a similar option to copy & paste from... ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.n

Re: [Toybox] [landley/toybox] « sed -i (edit in place) » used as root doesn't preserve uid nor gid (#52)

2016-09-30 Thread Rob Landley
On 09/30/2016 05:02 AM, ed38220 wrote: > Hi! > > Samsung Galaxy S4 Mini Plus I9195I (CM 13 unofficial) > toybox version : 0.7.0-892c602b10e7-android > > |# ls -l| > |-rw-rw 1 u0_a201 u0_a201 4 2016-09-30 11:35 bb_test.txt| > |-rw-rw 1 u0_a201 u0_a201 4 2016-09-30 11:35 tb_test.txt| > > |

Re: [Toybox] sed -e '$a\'

2016-03-26 Thread Rob Landley
On 03/26/2016 01:36 AM, Andy Chu wrote: >> The problem to solve here is that Debian is currently broken when using >> toybox. That's a real problem that needs to be fixed, but there's more >> than one way to fix it. Debian introduced this bug within the past few >> years and maybe we can convince

Re: [Toybox] sed -e '$a\'

2016-03-25 Thread Andy Chu
> The problem to solve here is that Debian is currently broken when using > toybox. That's a real problem that needs to be fixed, but there's more > than one way to fix it. Debian introduced this bug within the past few > years and maybe we can convince them to fix it on their end, that's one > pos

Re: [Toybox] sed -e '$a\'

2016-03-24 Thread Rob Landley
oesn't matter. If some script out there uses it, we'll notice when we get the bug report and decide then.) That said, have you read the toybox sed --help? I tried REALLY HARD to cover everything thoroughly and concisely. > Though I am wondering about the general toybox philosophy of &g

Re: [Toybox] sed -e '$a\'

2016-03-23 Thread Andy Chu
>> 2) It does indeed seem undocumented -- I can't find any mention of >> this (unintuitive) behavior in the GNU sed manual or FAQ: > > The _fun_ part is that this is doubly nonstandard, because the logic > I've used so far is if the line of input didn't have a newline, we > don't add one _until_ we

Re: [Toybox] sed -e '$a\'

2016-03-23 Thread Rob Landley
On Wed, Mar 23, 2016 at 1:30 PM, Andy Chu wrote: >> No idea whether that is a valid complaint. coreutils accepts it and >> treats it as "add a newline (but only if needed) and then do nothing". >> >> Debian's update-ca-certificates script uses that to conditionally add a >> newline after a file wh

Re: [Toybox] sed -e '$a\'

2016-03-23 Thread Andy Chu
> No idea whether that is a valid complaint. coreutils accepts it and > treats it as "add a newline (but only if needed) and then do nothing". > > Debian's update-ca-certificates script uses that to conditionally add a > newline after a file which may or may not end with a newline: > http://anonscm

Re: [Toybox] sed -e '$a\'

2016-03-23 Thread Rob Landley
On 03/23/2016 03:45 AM, Patrick Ohly wrote: > Hello! > > I mentioned on IRC recently that sed -e '$a\' /dev/null segfaults. It > was pointed out that commit 96a5ed118ce8ad fixes the segfault. I've now > tried that fix and it indeed fixes the segfault. > > However, the sed invocation above still

[Toybox] sed -e '$a\'

2016-03-23 Thread Patrick Ohly
Hello! I mentioned on IRC recently that sed -e '$a\' /dev/null segfaults. It was pointed out that commit 96a5ed118ce8ad fixes the segfault. I've now tried that fix and it indeed fixes the segfault. However, the sed invocation above still does not work because Toybox complains about the missing te

Re: [Toybox] toybox sed broken in all AOSP Marshmallow builds

2016-01-20 Thread Chris Renshaw
0 > Subject: Re: toybox sed broken in all AOSP Marshmallow builds > To: chris.rens...@live.com > CC: toybox@lists.landley.net > > if you search the archives (assuming they're working today) for > "toybox sed broken in Android Marshmallow (6.0) for LP32", you can see &

Re: [Toybox] toybox sed broken in all AOSP Marshmallow builds

2016-01-20 Thread enh
if you search the archives (assuming they're working today) for "toybox sed broken in Android Marshmallow (6.0) for LP32", you can see the bionic patch that fixed this. this has no impact on security, so it won't be backported. On Wed, Jan 20, 2016 at 10:32 AM, Chris Renshaw

[Toybox] toybox sed broken in all AOSP Marshmallow builds

2016-01-20 Thread Chris Renshaw
Hi guys, I just wanted to give you the heads up on sed being broken on my Nexus 5 and Nexus 7 2013 running the current Marshmallow 6.0.1 (MMB29S and MMB29O, respectively). Here is some example output:root@flo:/ # echo "blah" | sed "s/blah/test/"; testblah root@flo:/ # echo "blah" | busybox sed "s

[Toybox] toybox sed screwing up libtool?

2015-10-30 Thread Rob Landley
So, on irc you reported a bug, and I tried to reproduce it: Build root-filesystem-i686, chroot into it with toolchain attached. So that's something like: tar xvzf root-filesystem-i686.tar.gz tar xvzf native-compiler-i686.tar.gz mv native-compiler-i686 root-filesystem-i686/usr/overlay chro

Re: [Toybox] toybox sed broken in Android Marshmallow (6.0) for LP32

2015-09-05 Thread Rob Landley
On 09/04/2015 12:45 PM, enh wrote: > [since bug reports are as likely to come here as anywhere, FYI...] > > The toybox sed shipped in Android M doesn't work on LP32. (LP64 is > unaffected by this.) We build toybox with _FILE_OFFSET_BITS=64 and > there was a previously undisc

[Toybox] toybox sed broken in Android Marshmallow (6.0) for LP32

2015-09-04 Thread enh
[since bug reports are as likely to come here as anywhere, FYI...] The toybox sed shipped in Android M doesn't work on LP32. (LP64 is unaffected by this.) We build toybox with _FILE_OFFSET_BITS=64 and there was a previously undiscovered off_t lurking in . This is fixed in AOSP master by

Re: [Toybox] Sed problem

2015-03-23 Thread Felix Janda
David Halls wrote: > I'm trying to compile libiconv. It has this in its configure script: > > sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ > func_dirname ()\ > {\ > \case ${1} in\ > \ */*) func_dirname_result="${1%/*}${2}" ;;\ > \ * ) func_dirname_result="${3}" ;;\ > \es

[Toybox] Sed problem

2015-03-13 Thread David Halls
} # Extended-shell func_dirname implementation i.e. backslashes are left in, which bash barfs on. The busybox sed stripped out the backslashes, and libiconv compiled fine. Is Toybox sed only stripping out eol backslashes? David ___ Toybox mailing list T

Re: [Toybox] sed s/pattern/\/

2015-01-09 Thread Felix Janda
Rob Landley wrote: > On 01/08/2015 03:38 PM, Felix Janda wrote: > > sed doesn't allow embedded newlines in the replacement for s///, e.g. > > > > s/walrus/wal\ > > rus/ > > Indeed, that's the next sed bug I'm wrestling with right now. > > > It is not obvious to me how to fix this. There is some

Re: [Toybox] sed s/pattern/\/

2015-01-08 Thread Rob Landley
On 01/08/2015 03:38 PM, Felix Janda wrote: > sed doesn't allow embedded newlines in the replacement for s///, e.g. > > s/walrus/wal\ > rus/ Indeed, that's the next sed bug I'm wrestling with right now. > It is not obvious to me how to fix this. There is some code for dealing > with line continua

[Toybox] sed s/pattern/\/

2015-01-08 Thread Felix Janda
sed doesn't allow embedded newlines in the replacement for s///, e.g. s/walrus/wal\ rus/ It is not obvious to me how to fix this. There is some code for dealing with line continuations but I don't see how to use it. Felix ___ Toybox mailing list Toybox

Re: [Toybox] sed {N;N;} cmd test failure

2014-12-03 Thread Felix Janda
Rob Landley wrote: [..] > I believe the toybox behavior is right? > > We can simplify the above test by removing the p; entries that don't add > a line to the output: > > echo -ne '1\n2\n3\n4\n' | sed -n '1{N;N;d};2,3p;4p' > > Toybox just prints one 4, and gnu prints two of them. The differenc

Re: [Toybox] sed {N;N;} cmd test failure

2014-12-03 Thread Rob Landley
On 12/03/14 01:28, Ashwini Sharma wrote: > Hi Rob, > > While testing thru busybox sed tests, it failed at this test case. > > # first three lines are deleted; 4th line is matched and printed by > "2,3" and by "4" ranges > testing "sed with N skipping lines past ranges on next cmds" \ > "sed -n

[Toybox] sed {N;N;} cmd test failure

2014-12-02 Thread Ashwini Sharma
Hi Rob, While testing thru busybox sed tests, it failed at this test case. # first three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges testing "sed with N skipping lines past ranges on next cmds" \ "sed -n '1{N;N;d};1p;2,3p;3p;4p'" \ "4\n4\n" "" "1\n2\n3\n4\n

[Toybox] sed is tricksy.

2014-10-20 Thread Rob Landley
sed 0p # has a specific error message in ubuntu. Why? "sed 1,0p" # is allowed, equivalent to sed 1p # ^ so matching ranges always include first line. echo -e "salad\nsalad\nsalad" | sed -n '/salad/,/salad/p' # ^ starting trumps ending, so matching ranges don't require a gap. echo -e '\tx' | sed