You are not logged in.
GCONV_PATH=/usr/lib/gconv file /bin/bash
zsh: invalid system call GCONV_PATH=/usr/lib/gconv file /bin/bash
echo $?
159
GCONV_PATH=/ file /bin/bash
zsh: invalid system call GCONV_PATH=/usr/lib/gconv file /bin/bash
echo $?
159Doesn't matter if `GCONV_PATH` points to a valid location, it fails anyway.
This does not happen in ubuntu24 regardless if `GCONV_PATH` points to a valid location.
Offline
Offline
Or glibc if thats where the the backtrace leads as the backtrace leads to https://github.com/file/file/blob/FILE5 … ile.c#L674.
bt full
#0 __GI___getcwd (buf=buf@entry=0x0, size=size@entry=0) at ../sysdeps/unix/sysv/linux/getcwd.c:80
sc_ret = 79
path = 0x5fec30ac1800 "@\321\347\257\347y"
result = <optimized out>
alloc_size = <optimized out>
retval = <optimized out>
__PRETTY_FUNCTION__ = "__getcwd"
#1 0x000079e7afc9d78b in __gconv_get_path () at gconv_conf.c:394
user_len = <optimized out>
result = 0x0
__PRETTY_FUNCTION__ = "__gconv_get_path"
gconv_path = 0x7ffc3b66e460 "/usr/lib/gconv:/usr/lib/gconv"
gconv_path_len = <optimized out>
elem = <optimized out>
oldp = <optimized out>
cp = <optimized out>
nelems = <optimized out>
cwd = <optimized out>
cwdlen = <optimized out>
#2 0x000079e7afc9e445 in __gconv_read_conf () at gconv_conf.c:477
save_errno = 2
cnt = <optimized out>
cp = <optimized out>
#3 0x000079e7afd0fe74 in __pthread_once_slow (once_control=0x79e7afe7d72c <once>, init_routine=0x79e7afc9e3d0 <__gconv_read_conf>) at pthread_once.c:116
__cancel_routine = 0x79e7afd0fd30 <clear_once_control>
__clframe = {__cancel_routine = 0x79e7afd0fd30 <clear_once_control>, __cancel_arg = 0x79e7afe7d72c <once>, __do_it = 1, __buffer = {
__routine = 0x79e7afd0fcf0 <__pthread_cleanup_combined_routine_voidptr>, __arg = 0x7ffc3b66e620, __canceltype = 0, __prev = 0x0}}
val = <optimized out>
newval = <optimized out>
#4 0x000079e7afd0fee9 in ___pthread_once (once_control=once_control@entry=0x79e7afe7d72c <once>, init_routine=init_routine@entry=0x79e7afc9e3d0 <__gconv_read_conf>) at pthread_once.c:143
val = <optimized out>
#5 0x000079e7afc9e747 in __gconv_load_conf () at gconv_conf.c:528
No locals.
#6 0x000079e7afc9d2c6 in __gconv_find_transform (toset=toset@entry=0x79e7afe238c8 "INTERNAL", fromset=fromset@entry=0x7ffc3b66e700 "UTF-8//", handle=handle@entry=0x7ffc3b66e720,
nsteps=nsteps@entry=0x7ffc3b66e718, flags=flags@entry=0) at gconv_db.c:712
fromset_expand = <optimized out>
toset_expand = <optimized out>
result = <optimized out>
#7 0x000079e7afd37d21 in __wcsmbs_getfct (to=0x79e7afe238c8 "INTERNAL", from=0x7ffc3b66e700 "UTF-8//", nstepsp=0x5fec30abc538) at wcsmbsload.c:91
nsteps = 105468033509472
result = 0x1
#8 __wcsmbs_load_conv (new_category=<optimized out>) at wcsmbsload.c:187
charset_name = <optimized out>
complete_name = 0x7ffc3b66e700 "UTF-8//"
new_fcts = 0x5fec30abc530
use_translit = <optimized out>
data = 0x5fec30abb6b0
#9 0x000079e7afd35c75 in get_gconv_fcts (data=<optimized out>) at ./wcsmbsload.h:71
private = 0x5fec30abb6b0
#10 __GI___mbrtowc (pwc=pwc@entry=0x7ffc3b66e84c L"忬", s=<optimized out>, s@entry=0x7ffc3b670a82 "/bin/bash", n=<optimized out>, n@entry=9, ps=ps@entry=0x7ffc3b66e850) at mbrtowc.c:69
buf = L"忬"
--Type <RET> for more, q to quit, c to continue without paging--
data = {__outbuf = 0x7ffc3b66e84c "\354_", __outbufend = 0x7ffc3b66e850 "", __flags = 1, __invocation_counter = 0, __internal_use = 1, __statep = 0x7ffc3b66e850, __state = {
__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}}
status = <optimized out>
result = <optimized out>
dummy = 134033044406275
inbuf = 0xf0 <error: Cannot access memory at address 0xf0>
endbuf = <optimized out>
outbuf = <optimized out>
fcts = <optimized out>
fct = <optimized out>
__PRETTY_FUNCTION__ = "__mbrtowc"
#11 0x00005febf2cd7996 in file_mbswidth (ms=ms@entry=0x5fec30abc560, s=0x7ffc3b670a82 "/bin/bash") at /usr/src/debug/file/file/src/file.c:674
width = 0
bytesconsumed = <optimized out>
n = 9
state = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}
nextchar = 24556 L'忬'
#12 0x00005febf2cd6fdc in main (argc=2, argv=0x7ffc3b66eaa8) at /usr/src/debug/file/file/src/file.c:428
c = <optimized out>
i = <optimized out>
j = 1
wid = 0
nw = <optimized out>
action = 0
didsomefiles = 0
errflg = 0
flags = 67108864
e = 0
sandbox = <optimized out>
magic = 0x5fec30abc560
longindex = 0
magicfile = 0x0
progname = <optimized out>Edit:
Debian/Ubuntu disable files seccomp sandbox which does not allow getcwd https://github.com/file/file/blob/maste … omp.c#L103. Apologies to Allan.
Last edited by loqs (2025-11-24 01:05:41)
Offline
Running file with the -S flag confirms it is the sandbox.
Offline
Patch for file's seccomp sandbox to allow getgwd:
diff --git a/src/seccomp.c b/src/seccomp.c
index ce824330..916efe5f 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -99,6 +99,7 @@ enable_sandbox(void)
ALLOW_RULE(fstatat64);
#endif
ALLOW_RULE(futex);
+ ALLOW_RULE(getcwd);
ALLOW_RULE(getdents);
#ifdef __NR_getdents64
ALLOW_RULE(getdents64);Edit:
@Samueru please report the issue on https://bugs.astron.com/my_view_page.php if it has no been already.
Last edited by loqs (2025-11-24 20:54:45)
Offline
Alright will report to upstream directly, it's a shame though given that it can take years for file to make a new stable release.
Btw I found that if I set `LC_ALL=C` this fixes the crash when GCONV_PATH is set, so I guess I will be doing this in the long meantime.
Offline
Arch is already carrying a patch for file's seccomp sandbox so I suspect the package maintainers will accept a merge request adding a patch for this issue once upstream has accepted it without needing to wait for a new upstream release.
Offline