jeorge
2023-05-22 22:47:32 UTC
Hello,
I'm wanting to take advantage of the readdir.so dynamic library that
ships with gawk but I'm having an issue on the target system which the
following test code reveals:
#-- test code --
@load "readdir"
BEGIN{
d="/proc/sys"
f=d"/kernel/version"
FS="/"
while(getline<d)
if($3=="d")
print $2
close(d)
FS=" "
while(getline<f)
print $0
close(f)
print "\nGNU Awk",PROCINFO["version"]
}
#-- ---- ---- --
Output on my home system look fine but on the target system I get the
following errors/warnings right after the /proc/sys directory listing
which I don't understand:
#-- error msg --
awk: cmd. line:1: warning: dir_take_control_of: opendir/fdopendir
failed: Not a directory
awk: cmd. line:1: warning: input parser `readdir' failed to open
`/proc/sys/kernel/version'
#-- ----- --- --
Versioning (last line in code):
- home system: GNU Awk ver: 5.1.0
- target system: GNU Awk ver: 5.2.2
Other info for target machine:
- OS = Arch Linux (64bit)
- AWKLIBPATH = /usr/lib/gawk
- $ gawk --version |head -n1
=> GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p9, GNU MP
6.2.1)
Does this look like a fixable configuration quirk not requiring
recompiling or something else? I'm not admin on the target system but
benign configuration tweaks would likely be an option.
-J
I'm wanting to take advantage of the readdir.so dynamic library that
ships with gawk but I'm having an issue on the target system which the
following test code reveals:
#-- test code --
@load "readdir"
BEGIN{
d="/proc/sys"
f=d"/kernel/version"
FS="/"
while(getline<d)
if($3=="d")
print $2
close(d)
FS=" "
while(getline<f)
print $0
close(f)
print "\nGNU Awk",PROCINFO["version"]
}
#-- ---- ---- --
Output on my home system look fine but on the target system I get the
following errors/warnings right after the /proc/sys directory listing
which I don't understand:
#-- error msg --
awk: cmd. line:1: warning: dir_take_control_of: opendir/fdopendir
failed: Not a directory
awk: cmd. line:1: warning: input parser `readdir' failed to open
`/proc/sys/kernel/version'
#-- ----- --- --
Versioning (last line in code):
- home system: GNU Awk ver: 5.1.0
- target system: GNU Awk ver: 5.2.2
Other info for target machine:
- OS = Arch Linux (64bit)
- AWKLIBPATH = /usr/lib/gawk
- $ gawk --version |head -n1
=> GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p9, GNU MP
6.2.1)
Does this look like a fixable configuration quirk not requiring
recompiling or something else? I'm not admin on the target system but
benign configuration tweaks would likely be an option.
-J