getcwd() and friends.
The Grey Wolf
greywolf at unisoft.UUCP
Fri Apr 7 12:31:56 AEST 1989
In article <4438 at psuvax1.cs.psu.edu> schwartz at shire.cs.psu.edu (Scott Schwartz) writes:
# In article <811 at mtxinu.UUCP>, ed at mtxinu (Ed Gould) writes:
# >
# > >>One thing that really would make things a lot easier would be a fchdir()
# > >>call, that took a file descriptor and tried to chdir to it.
# >
# >Worse than that, the permission required to open a directory is "r"
# >(since one may not open a directory for writing), whereas the
# >permission required to change to one is "x". Hence, Unix protection
# >would be completely violated by the existance of fchdir().
#
# As long as we have entered the magical world of unix++, how about
# this: Add a new flag to open, O_EXEC, that would permit opening a file
# for execution only. Then to do an fchdir() you would first open the
# directory for execution. Similarly, fexecve() would take a descriptor
# opened for execution. "Open for execution" would be operationally
# defined as "can only be passed to fchdir(), fexecve(), or close()".
This looks like a good idea...
#
# [ more about open(), fchdir... et al. ]
#
# Frankly, I think permitting more system calls to take fd arguments
# rather than pathnames would be a big win. It certainly seems more
# logical in most cases.
Do you really mean "rather than" as "instead of"? I like the idea of
being able to do either/or, depending on what you wanted to do. I mean,
if they were "instead of", and chmod() were eliminated so that only
fchmod remained, how would you change the mode of a file that was mode
000? You wouldn't be able to O_RDWR or O_EXEC the file/directory and
therefore couldn't gain a valid file descriptor to pass to fchmod().
I think that the option of f() commands should remain open.
#
# P.S. Given that directories are chdir-able iff they are marked
# executable, why do sh/csh/et.al. require that you type "cd"??
# Just execute the directory by chdir-ing to it!
At the College of Marin, some friends of mine (and later myself) modified the
4.1 c shell (Yeah, I *know* it's not everyone's favourite, but it IS mine!
(no accounting for taste?)) to do just that. I later incorporated the
modification into the 4.3 csh. It depended upon a variable called "autogoto".
bit of trivia
my roommate (a main writer of dsh) prefers not to use this feature,
since it has stung him too many times. He administers a system on which such
users as "ls" exist, for example. He's in the main users directory, and types
"ls" and receives nothing but a prompt. Imagine his initial shock --
"OH NO! WHERE ARE ALL THE USERS' DIRECTORIES!!!???"...)
Roan Anderson, Third Assistant Technogeek to the Third Assistant Technogeek.
(gotta watch out for #3 sometime :-)
--
...TheysaidDoyouseethebiggreenglowinthedarkhouseuponthehill?andIsaidYesIseethebiggreenglowinthedarkhouseuponthehillTheresabigdarkforestbetweenmeandthebiggreenglowinthedarkhouseuponthehillandalittleoldladyonaHoovervacuumcleanersayingIllgetyoumyprettyandyourlittledogTototoo
I don't even *HAVE* a dog Toto...
More information about the Comp.unix.wizards
mailing list