Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

fchdir not implemented in NeXTSTEP/OPENSTEP



Hi! I've been trying to compile zsh 3.1.1 for NeXTSTEP 3.3 and/or OPENSTEP  
4.1. Everything compiles cleanly except for two lines which call the function  
fchdir. NeXTSTEP/OPENSTEP do not implement the fchdir system call so I've  
tried to replace all (all of two) occurances of fchdir(fd) with  
chdir(dirname). Bear with me, I'm only a sys admin not a programmer. Here is  
what I have:

This comes from the Src/compat.c file in the function zchdir(). The variable  
currdir seems to only be assigned file descriptors for the directory "." so  
I replaced fchdir(currdir) with chdir("."). Will this work?

/*    if (currdir == -1 || (currdir >= 0 && fchdir(currdir))) { */
/* Changed by Leo to remove the fchdir function call. */

    if (currdir == -1 || (currdir >= 0 && chdir("."))) {

This comes from the Src/utils.c file in the function lchdir(). The struct d  
seems to always have d->dirname defined (or defined as NULL) so I've replaced  
fchdir(d->dirfd) with chdir(d->dirname). Since both chdir and fchdir have  
the same exit values for the same reasons I assumed the logic wouldn't break.

/*      if (!fchdir(d->dirfd)) { */
/* Changed by Leo to remove the fchdir function call. */

        if (!chdir(d->dirname)) {

If you could help me out I'd really appreciate it. I'm a loyal follower of  
zsh releases but this is the first time I've had to compile it. Obviously, if  
the changes I made are correct and you'd like to add these changes to the  
source code, feel more than free to do so. [my changes do build a working  
executable as far as I can tell.]

I was also told to mention that I'm not a subscriber to the zsh-workers list  
and the output of reporter follows my signature. I can't give you a zsh -f  
report as I can't compile zsh without the changes I made.

Thanks a bundle!

leo.

+---------------------+---------------------------------+
| Leo Turetsky        |  BLaCKSMITH, Inc.   (NeXT/MIME) |
| leo@xxxxxxxxxxxxxx  |  OPENSTEP Systems Administrator |
+---------------------+---------------------------------+
| Nah-ne kah-sah tahng-tah? <esp> Leo, your mom called. |
+-------------------------------------------------------+

Reporter breaks with the following output if I use my newly compiled zsh  
(3.1.1) or version 2.6 beta 10:

<uni>74% /usr/local/bin/zsh reporter
# START zsh saveset
# uname:  NEXTSTEP uni Lantern4S 4.1 Generic SPARC

# Aliases.

reporter: bad option: L [204]
reporter: condition expected: == [223]
reporter: condition expected: == [224]
zsh: 7766 segmentation fault  /usr/local/bin/zsh reporter
<uni>75%                       /private/Net/knuth/Users1/leo/tmp/zsh-3.1.1/Util


Working Reporter output using default zsh of NeXTSTEP 3.3:

<tyler>9% /usr/bin/zsh reporter
# START zsh saveset
# uname:  NEXTSTEP tyler Lightning9I 3.3 Intel 586 I386

# Aliases.

reporter: bad option: L [204]
reporter: condition expected: == [223]
reporter: condition expected: == [224]

reporter: bad option: L [226]
reporter: parse error near `}' [227]
reporter: bad option: l [228]
reporter: parse error near `)' [229]
reporter: parse error near `fi' [230]

# Completions.

reporter: compctl: bad option: L [243]

# Undefined functions.


# Defined functions.


# Limits.

limit datasize        6m
limit stacksize       8m
limit coredumpsize    0k

# Modules: zmodload not available.

# Non-array variables.

TERMCAP=''
TERM='vt100'
ARGC="0"
AWK="awk"
BAUD="0"
CDPATH=""
COLUMNS="80"
CPP="/lib/cpp"
DIRSTACKSIZE="-1"
DISPLAY="tyler:0.0"
EDITOR="emacs"
EGID="20"
ENSCRIPT="-2Gr"
ERRNO="9"
EUID="140"
FCEDIT="vi"
FIGNORE=""
FPATH=""
GID="20"
HACKPAGER="more"
HISTCHARS="!^#"
HISTSIZE="30"
HOME="/Net/knuth/Users1/leo"
HOST="tyler"
HOSTTYPE="next"
KEYTIMEOUT="40"
LINENO="348"
LINES="24"
LISTMAX="100"
LITHISTSIZE="5"
LOGCHECK="60"
LOGNAME="leo"
MAIL=""
MAILCHECK="60"
MAILPATH=""
MANPAGER="more"
MANPATH="/usr/host/man:/usr/local/imagetools/man:/usr/local/cvs/man:/usr/local/man:/usr/man:/usr/gnu/man:/usr/local/lib/tcl:/usr/X11R6/man"
NULLCMD="cat"
OLDPWD="/private/Net/knuth/Users1/leo/src/zsh-3.1.1/Util"
OPTARG=""
OPTIND="1"
PAGER="more"
PATH="/usr/X11R6/bin:/usr/local/gnu/bin:/usr/local/gnu/etc:/usr/local/bin:/usr/local/etc:/usr/bin:/usr/ucb:/usr/etc:/etc:/bin:/Net/knuth/Users1/leo/bin:/Net/knuth/Users1/leo/Apps:/usr/host/bin:/usr/gnu/bin:/Net/knuth/Users1/lindberg/Unix/bin:/LocalApps:/LocalDeveloper/Demos:/NextApps:/NextAdmin:/NextDeveloper/Demos:/Games:."
PERIOD="0"
POSTEDIT=""
PPID="15761"
PRINTER="Ginsberg"
PROMPT="%b<%m>%B%h%#%b "
PROMPT2="%B>%b "
PROMPT3="%B?#%b "
PROMPT4="%B+%b "
PS1="%b<%m>%B%h%#%b "
PS2="%B>%b "
PS3="%B?#%b "
PS4="%B+%b "
PSVAR=""
PWD="/private/Net/knuth/Users1/leo/src/zsh-3.1.1/Util"
RANDOM="27781"
READNULLCMD="more"
REPORTTIME="-1"
RPROMPT=" %B%~%b"
RPS1=" %B%~%b"
SAVEHIST="0"
SECONDS="3"
SHELL="/usr/local/bin/zsh"
SHLVL="3"
SPROMPT="zsh: correct \`%R\' to \`%r\' [nyae]? "
TERMINFO="/usr/local/gnu/lib/terminfo"
TIMEFMT="%E real  %U user  %S system  %P"
TMOUT="0"
TMPPREFIX="/tmp/zsh"
TTY=""
UID="140"
USER="leo"
USERNAME="leo"
VERSION="zsh 2.5.02"
WATCH=""
WATCHFMT="%n has %a %l from %m."
WORDCHARS="*?_-.[]~=/&;!#$%^(){}<>"
each="/Net/knuth/Users1/lindberg/Unix/bin"
reporter_OSVersion="NEXTSTEP_3.3"
reporter_junkiequotes="no"
status="1"
str="NEXTSTEP tyler Lightning9I 3.3 Intel 586 I386"
prompt='test%'

# Array variables.

argv=()
cdpath=()
fignore=()
fpath=()
mailpath=()
manpath=(/usr/host/man /usr/local/imagetools/man /usr/local/cvs/man  
/usr/local/man /usr/man /usr/gnu/man /usr/local/lib/tcl /usr/X11R6/man)
path=(/usr/X11R6/bin /usr/local/gnu/bin /usr/local/gnu/etc /usr/local/bin  
/usr/local/etc /usr/bin /usr/ucb /usr/etc /etc /bin /Net/knuth/Users1/leo/bin  
/Net/knuth/Users1/leo/Apps /usr/host/bin /usr/gnu/bin  
/Net/knuth/Users1/lindberg/Unix/bin /LocalApps /LocalDeveloper/Demos  
/NextApps /NextAdmin /NextDeveloper/Demos /Games .)
psvar=()
signals=(EXIT HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM  
TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH USR1  
USR2 ZERR DEBUG)
watch=()

# Exported variables.

export TERMCAP
export TERM
export DISPLAY
export EDITOR
export ENSCRIPT
export HACKPAGER
export HOME
export LOGNAME
export MANPAGER
export MANPATH
export PAGER
export PATH
export PRINTER
export PROMPT
export PROMPT2
export PROMPT3
export PROMPT4
export PWD
export RPROMPT
export SHELL
export SHLVL
export TERM
export TERMINFO
export TIMEFMT
export USER

# Setopt.

setopt bgnice
setopt hashcmds
setopt hashdirs
setopt hashlistall
setopt notify

# END zsh saveset
<tyler>10%                     /private/Net/knuth/Users1/leo/src/zsh-3.1.1/Util



Messages sorted by: Reverse Date, Date, Thread, Author