Skip to contentSkip to conversation

vfs: show unreachable paths in getcwd and proc - breaks screen in chroot env

DISCUSSION Miklos Szeredi 1 participant 1 message Oct 4, 2010 3 messages not in the archive VFS

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive
Quoted 36 lines · Martin Jansa
Quoted 15 lines · Miklos Szeredi
Quoted 7 lines · Martin Jansa

Hi,

your patch 8df9d1a4142311c084ffeeacb67cd34d190eff74
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8df9d1a4142311c084ffeeacb67cd34d190eff74

breaks GNU screen when it's used from chroot, is it expected behavior or one of the cases of d_path() usage where it shouldn't be touched?

I guess screen is doing something like

   readlink(proc_path, link, linksize);
   fd = open(link, O_...);
   ...
Quoted 8 lines

This is wrong, it should be doing

   fd = open(proc_path, O_...);

instead.

Thanks,
Miklos

Hi,

screen is using char *ttyname(int fd) call which returns (unreachable) too. It also calls own function stripdev on returned string, so for now I'll strip "(unreachable)" there as workaround, but ttyname() should be still fixed in libc :/, no idea how often it's used in other apps.

Here is testcase:
#include <unistd.h>
#include <stdio.h>

Quoted 7 lines

int main(int argc, char **argv) {
char * tty;
tty = ttyname(0);
printf("ttyname(0): '%s'\n", tty);
}

Regards,

Stripping "(unreachable)" from the beginning is not always the correct answer. Libc should also verify that the resulting path (which is basically just a heuristic) does really refer to same device as the file descriptor.

Thanks,
Miklos