bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macr


From: Andrew J. Schorr
Subject: Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macro
Date: Thu, 17 Apr 2014 20:25:09 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Arnold,

On Thu, Apr 17, 2014 at 06:10:42PM +0300, Aharon Robbins wrote:
> I'm OK with moving all the matching into inetfile().  Please let me know
> when you have a patch for review.

Please find attached a proposed patch.  I ran one test, and it seems
to work for me.  Note the difference in behavior:

gawk 4.1.0:

   bash-4.2$ gawk 1 /inet/fubar
   gawk: fatal: no (known) protocol supplied in special filename `/inet/fubar'

   bash-4.2$ gawk 1 /inet/tcp/fubar
   gawk: fatal: special file name `/inet/tcp/fubar' is incomplete

   bash-4.2$ gawk 1 /inet/tcp/0/blah
   gawk: fatal: must supply a remote hostname to `/inet'

   bash-4.2$ gawk 1 /inet/tcp/0/blah/fubar
   gawk: fatal: remote host and port information (blah, fubar) invalid

Patched gawk:

   bash-4.2$ gawk 1 /inet/fubar
gawk: fatal: cannot open file `/inet/fubar' for reading (No such file or 
directory)

   bash-4.2$ ./gawk 1 /inet/tcp/fubar
   gawk: fatal: cannot open file `/inet/tcp/fubar' for reading (No such file or 
directory)

   bash-4.2$ ./gawk 1 /inet/tcp/0/blah
   gawk: fatal: cannot open file `/inet/tcp/0/blah' for reading (No such file 
or directory)

   bash-4.2$ ./gawk 1 /inet/tcp/0/blah/fubar
   gawk: fatal: remote host and port information (blah, fubar) invalid


I ran valgrind on it, and I found this error.  However, it also occurs
with gawk 4.1.0.  Is this a bug in glibc?

address@hidden: valgrind ./gawk 1 /inet/tcp/0/localhost/13
==21545== Memcheck, a memory error detector
==21545== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==21545== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==21545== Command: ./gawk 1 /inet/tcp/0/localhost/13
==21545== 
gawk: fatal: cannot open file `/inet/tcp/0/localhost/13' for reading (No such 
file or directory)
==21545== Invalid free() / delete / delete[] / realloc()
==21545==    at 0x4C294C4: free (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21545==    by 0x5BB170B: __libc_freeres (in /usr/lib64/libc-2.17.so)
==21545==    by 0x4A236B4: _vgnU_freeres (in 
/usr/lib64/valgrind/vgpreload_core-amd64-linux.so)
==21545==    by 0x5A8723A: __run_exit_handlers (in /usr/lib64/libc-2.17.so)
==21545==    by 0x5A872C4: exit (in /usr/lib64/libc-2.17.so)
==21545==    by 0x45D313: final_exit (msg.c:186)
==21545==    by 0x45D346: gawk_exit (msg.c:172)
==21545==    by 0x45D5C0: err (msg.c:104)
==21545==    by 0x45D89B: r_fatal (msg.c:158)
==21545==    by 0x43F979: r_interpret (interpret.h:1145)
==21545==    by 0x40CDC4: main (main.c:746)
==21545==  Address 0x5e083f0 is 0 bytes inside data symbol "noai6ai_cached"
==21545== 
==21545== 
==21545== HEAP SUMMARY:
==21545==     in use at exit: 38,921 bytes in 109 blocks
==21545==   total heap usage: 325 allocs, 217 frees, 72,145 bytes allocated
==21545== 
==21545== LEAK SUMMARY:
==21545==    definitely lost: 0 bytes in 0 blocks
==21545==    indirectly lost: 0 bytes in 0 blocks
==21545==      possibly lost: 0 bytes in 0 blocks
==21545==    still reachable: 38,921 bytes in 109 blocks
==21545==         suppressed: 0 bytes in 0 blocks
==21545== Rerun with --leak-check=full to see details of leaked memory
==21545== 
==21545== For counts of detected and suppressed errors, rerun with: -v
==21545== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)

This is on Fedora 19 x86_64 with glibc-2.17-20.fc19.x86_64.

Regards,
Andy

Attachment: inetfile.patch
Description: Text document


reply via email to

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