bug-coreutils
[Top][All Lists]
Advanced

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

Re: logical paths


From: Kartik K. Agaram
Subject: Re: logical paths
Date: Sun, 10 Sep 2006 17:05:26 -0500 (CDT)

Just about every system call that deals with file names will have to deal with file names that contain "..".

I don't think this is true. For example, there's a call to chdir("..") in remove.c::AD_pop_and_chdir() that I'm pretty sure won't need to be touched. As another example, the calls to fopen() temp files in the operation of sort don't need to be touched. I didn't have to search too hard to find such examples, so I don't think they are rare.

Wouldn't it be easier to change your C library instead? That would fix the problem for (almost) all programs, not just for coreutils.

That seems like a bad idea:

0. We don't *have* to change the semantics of all file operations everywhere one sees them. As I mentioned above we only need to change places operating on externally visible path names.

1. I don't think we even *should* change the semantics of stat() to read $PWD for every single user of libc out there. The further down I go the software stack the more likely I am to run into unforeseen consequences, scenarios that affect other people. I thought about this alternative when I suggested adding an option: we avoid changing *default* behavior that people might already be relying upon in their scripts.

2. The further down I go the software stack the harder it will get *politically* to make changes. And with good reason; the further down the stack one gets the more conservative people have to be about changing things because of one random guy's input. Who knows what implications may result? See previous point.

That sort of reasoning is why I went first to bash to see if there was a fix in the shell. I have no illusions that I can go around back-patching every piece of UNIX software out there to respect logical paths. Logical paths will remain a leaky abstraction, I'm just trying to explore whether we can get a lot of bang for a little buck by changing coreutils. The answer to that may well be in the negative.

---

Does anybody have a comment on how common file operations are on externally visible path names? There are ~100 occurrences of calls to *stat(), a lot of those would need to change I think. That and a few of the ~30 calls to fopen() should get us most of the way there.

Am I talking through my hat? Or is this a significant enough set of changes to make people uncomfortable without some extensive testing? Again, I'm not recommending changing default behavior.

Thanks,
Kartik




reply via email to

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