bug-gawk
[Top][All Lists]
Advanced

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

Re: Fwd: inconstancy with RS = "(\r?\n){2}"


From: Alex fxmbsw7 Ratchev
Subject: Re: Fwd: inconstancy with RS = "(\r?\n){2}"
Date: Mon, 26 Jul 2021 20:37:38 +0200

on seemfully a second more successful c-c try in the same session:

read(0, "\n", 4096)                     = 1
read(0, "", 4096)                       = 0
openat(AT_FDCWD, "/dev/null", O_RDWR)   = 3
dup2(3, 0)                              = 0
close(3)                                = 0
write(1, "\na\n\n\na\na\na\na\n\n\n", 15) = 15
exit_group(0)                           = ?
+++ exited with 0 +++

so it read, lots of, then just at the end printed
no ?
:/
:)

On Mon, Jul 26, 2021 at 8:36 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
> looks to me like a dead loop or so, no call
> i dunno, u tell me
>
> getegid()                               = 0
> ioctl(1, TCGETS, 0x7ffc46789de0)        = -1 ENOTTY (Inappropriate
> ioctl for device)
> fstat(0, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
> ioctl(0, TCGETS, 0x7ffc46789cc0)        = -1 ENOTTY (Inappropriate
> ioctl for device)
> fstat(0, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> fstat(1, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
> read(0, ^[[C"a\n", 4096)                    = 2
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> read(0, "a\n", 4096)                    = 2
> read(0, "a\n", 4096)                    = 2
> read(0, "a\n", 4096)                    = 2
> read(0, "a\n", 4096)                    = 2
> read(0, "\n", 4096)                     = 1
> read(0, "\n", 4096)                     = 1
> read(0,
>
> On Mon, Jul 26, 2021 at 8:33 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
> wrote:
> >
> > or does it mean it printed, but i didnt notice where
> > wouldnt make the other old server ware work, they work the same as as
> > i try still now
> > it actually printed \n, then on second \n and fstat, then again read
> >
> > On Mon, Jul 26, 2021 at 8:32 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
> > wrote:
> > >
> > > i did strace -fF -s 50 the gawk in the tcpserver
> > >
> > > these are the last lines, the fstat being printed after
> > >
> > > read(0, "\n", 4096)                     = 1
> > > read(0, "\n", 4096)                     = 1
> > > fstat(1, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
> > > read(0,
> > >
> > > does this mean.. what.. didnt process two \ns as RS = \n\n ?
> > >
> > > On Mon, Jul 26, 2021 at 8:14 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
> > > wrote:
> > > >
> > > > i mailed their misc@ address
> > > >
> > > > anyway before i had "\n\n" as RS stuff worked, curl wise etc
> > > > but its on an outdated version so nothing about it
> > > > maybe new, but first find why it doesnt print
> > > >
> > > > On Mon, Jul 26, 2021 at 8:07 PM Alex fxmbsw7 Ratchev 
> > > > <fxmbsw7@gmail.com> wrote:
> > > > >
> > > > > and indeed i sometimes recieve nothing
> > > > >
> > > > > tcpserver 0 1024 gawk -v RS=\\n\\n '{ print "ye" }'
> > > > >
> > > > > and in nc to it, many newlines, no ye back
> > > > > hmh ?
> > > > >
> > > > > ill look up if i can find the mailing list
> > > > >
> > > > > On Mon, Jul 26, 2021, 20:03 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
> > > > > wrote:
> > > > >>
> > > > >> no idea, with RS = "\n\n" on terminal no prob, but it may br 
> > > > >> tcpservers fault, or gawk fail to recognize raw data by tcpserver
> > > > >> curl doesnt return, control-c makes the bash reader that reads the 
> > > > >> gawk recieve it, not before, hmm ..
> > > > >>
> > > > >> On Mon, Jul 26, 2021, 19:17 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
> > > > >> wrote:
> > > > >>>
> > > > >>> id like to keep the double \n RS as was in my code, so i just 
> > > > >>> separately before strip em away
> > > > >>>
> > > > >>> thanks you for your input :)
> > > > >>>
> > > > >>> On Mon, Jul 26, 2021, 19:01 Ed Morton <mortoneccc@comcast.net> 
> > > > >>> wrote:
> > > > >>>>
> > > > >>>>
> > > > >>>>
> > > > >>>> On 7/26/2021 11:27 AM, Alex fxmbsw7 Ratchev wrote:
> > > > >>>>
> > > > >>>> i will cause i have to RS = "" and FS = "\n"
> > > > >>>> and in another gawk strip the optional \r's away
> > > > >>>>
> > > > >>>> It wasn't clear to me that you wanted to just discard the `\r`s, 
> > > > >>>> that makes things even simpler. Given that - yes, you can use a 
> > > > >>>> separate call to awk to remove `\r`s before piping to your real 
> > > > >>>> script or you can do what I suggested below but change `$0 ~ 
> > > > >>>> /^\r?$/` to `{ sub(/\r$/,"") } $0 == ""`.
> > > > >>>>
> > > > >>>>     Ed.
> > > > >>>>
> > > > >>>> On Mon, Jul 26, 2021, 17:01 Ed Morton <mortoneccc@comcast.net> 
> > > > >>>> wrote:
> > > > >>>>
> > > > >>>> On 7/26/2021 8:15 AM, Alex fxmbsw7 Ratchev wrote:
> > > > >>>>
> > > > >>>> ---------- Forwarded message ---------
> > > > >>>> From: Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> <fxmbsw7@gmail.com>
> > > > >>>> Date: Mon, Jul 26, 2021, 15:13
> > > > >>>> Subject: Re: inconstancy with RS = "(\r?\n){2}"
> > > > >>>> To: Aharon Robbins <arnold@skeeve.com> <arnold@skeeve.com>
> > > > >>>>
> > > > >>>>
> > > > >>>> but the RS issue remains
> > > > >>>> oh well up to better times somewhen else
> > > > >>>> thanks :)
> > > > >>>>
> > > > >>>>
> > > > >>>> Have you considered just writing code to decide if a pair of 
> > > > >>>> `\r?\n`s has
> > > > >>>> been seen instead of using a more complicated RS? For example, 
> > > > >>>> using the
> > > > >>>> default RS and ORS, I think this will do what you want:
> > > > >>>>
> > > > >>>> --------
> > > > >>>> $ cat tst.awk
> > > > >>>> $0 ~ /^\r?$/ {
> > > > >>>>     gotRS = 1
> > > > >>>>     lineNr = 0
> > > > >>>> }
> > > > >>>> !gotRS {
> > > > >>>>     # just keep appending to the record until the real RS is found
> > > > >>>>     rec = ( ++lineNr == 1 ? "" : rec ORS) $0
> > > > >>>>     next
> > > > >>>> }
> > > > >>>> {
> > > > >>>>     # we have a complete record so save it in $0 and process as 
> > > > >>>> normal
> > > > >>>>     gotRS = 0
> > > > >>>>     $0 = rec
> > > > >>>>     print "<" $0 ">"
> > > > >>>> }
> > > > >>>> --------
> > > > >>>> $ awk -f tst.awk
> > > > >>>> 1
> > > > >>>> 2
> > > > >>>>
> > > > >>>> <1
> > > > >>>> 2>
> > > > >>>> 3
> > > > >>>>
> > > > >>>> <3>
> > > > >>>> --------
> > > > >>>>
> > > > >>>> Regards,
> > > > >>>>
> > > > >>>>     Ed.
> > > > >>>>
> > > > >>>>
> > > > >>>>
> > > > >>>> On Mon, Jul 26, 2021, 15:12 <arnold@skeeve.com> 
> > > > >>>> <arnold@skeeve.com> wrote:
> > > > >>>>
> > > > >>>>
> > > > >>>> I'm sorry.
> > > > >>>>
> > > > >>>> I give up.
> > > > >>>>
> > > > >>>> You will have to use another approach. Maybe using gawk's built-in
> > > > >>>> networking will help.
> > > > >>>>
> > > > >>>> Good luck.
> > > > >>>>
> > > > >>>> Arnold
> > > > >>>>
> > > > >>>> Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> <fxmbsw7@gmail.com> wrote:
> > > > >>>>
> > > > >>>>
> > > > >>>> and no it doesnt work
> > > > >>>> also on the stderr cmd i had to quit nc ( didnt try control d ) 
> > > > >>>> and then
> > > > >>>> the rest appeared, on the tcpserv side, .. seems bug nothing done
> > > > >>>> i fetched git clone new and did bootstrap and further
> > > > >>>>
> > > > >>>> On Mon, Jul 26, 2021, 15:07 Alex fxmbsw7 Ratchev 
> > > > >>>> <fxmbsw7@gmail.com> <fxmbsw7@gmail.com>
> > > > >>>>
> > > > >>>> wrote:
> > > > >>>>
> > > > >>>>  i just got now to it
> > > > >>>> in my testing on terminal still same bug, on testing that gawk > 
> > > > >>>> stderr
> > > > >>>> cmd even more newlines were needed to make it print ( on the 
> > > > >>>> tcpserv
> > > > >>>>
> > > > >>>> term )
> > > > >>>>
> > > > >>>> that makes it invalid for my httpd and the bug but ill just try 
> > > > >>>> now too
> > > > >>>>
> > > > >>>> On Mon, Jul 26, 2021, 13:24 Alex fxmbsw7 Ratchev 
> > > > >>>> <fxmbsw7@gmail.com> <fxmbsw7@gmail.com>
> > > > >>>> wrote:
> > > > >>>>
> > > > >>>>
> > > > >>>> thank you big time ! ill just test now
> > > > >>>> sorry for not knowing much git
> > > > >>>>
> > > > >>>> On Mon, Jul 26, 2021, 13:17 <arnold@skeeve.com> 
> > > > >>>> <arnold@skeeve.com> wrote:
> > > > >>>>
> > > > >>>>
> > > > >>>> Please do
> > > > >>>>
> > > > >>>>         make distclean
> > > > >>>>         git pull
> > > > >>>>         git checkout test-socket-patch
> > > > >>>>         ./bootstrap.sh && ./configure && make
> > > > >>>>
> > > > >>>> I applied the patch and pushed it to git in that branch.
> > > > >>>>
> > > > >>>> Arnold
> > > > >>>>
> > > > >>>>
> > > > >>>>
> > > > >>>>
> > > > >>>>



reply via email to

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