Open kofemann opened 8 years ago
Isn't that the same behavior as we had before? inode2path also returned an empty string when called with the root pnfsid. That's the behavior I tried to keep.
Yes, the original code from 2005 has this. But this does not prevent as from fixing. Obviously that flow was never used up to now. We have discovered it by accident.
Well, I knew about it and didn't dare to change it as you probably had good reasons to implement it that way :-) But feel free to "fix".
It seems that these functions could deserve some more polishing (dcache 2.15):
path2inode('000000000000000000000000000000000000', '
I think sice there cannot be a directory of an empty name, that would justify to handle e.g. pnfs/foo differently from pnfs//foo, these functions should because of robustness automatically collapse any // and also remove and leading and trailing / as necessary,... shouldn't it?
Well, these functions are not for direct user input and thus dcache already does that kind of cleaning of the input. These are used by dcache itself. Pgsql isn't the fastest of all languages and thus I wouldn't add stuff like this.
As Gerd already said, inumber2path is not designed to be used by users. It's a postgres specific optimization used by dcache.
hmm, I see.. would it perhaps make sense to have "export" versions of these functions, basically wrappers which sanitise the input? It seems to make sense, as 3rd party stuff like the recent chimera_find.sh case do make use of these functions.
if N is an inumber of a root inode, then inumber2path(N) will return empty string: