Closed Bug 532417 Opened 12 years ago Closed 12 years ago

Build problem with spaces in path names

Categories

(NSS :: Build, defect)

x86
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
3.12.6

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(2 files, 1 obsolete file)

Attached patch Proposed patch (obsolete) — Splinter Review
This is the NSS coreconf version of NSPR bug 473413.

On my Windows 7 computer, my user account name is
"Wan-Teh Chang", with a space in it.  I created a
directory under my home directory (C:\Users\Wan-Teh Chang)
and checked out an NSS source tree.  When I built it,
the build failed with this error:

cd src; make libs
make[2]: Entering directory `/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/securit
y/dbm/src'
cl -FoWINNT6.1_DBG.OBJ/db.obj -c -Zi -FdWINNT6.1_DBG.OBJ/ -Od -W3 -nologo -D_CRT
_SECURE_NO_WARNINGS -MD -we4002 -we4003 -we4004 -we4006 -we4009 -we4013 -we4015
-we4028 -we4033 -we4035 -we4045 -we4047 -we4053 -we4054 -we4063 -we4064 -we4078
-we4087 -we4098 -we4390 -we4551 -we4553 -we4715 -GT -DXP_PC -DDEBUG -D_DEBUG -UN
DEBUG -DDEBUG_Wan_Teh_Chang -DWIN32 -D_X86_ -D_WINDOWS -DWINNT -DUSE_UTIL_DIRECT
LY -DSTDC_HEADERS -DHAVE_STRERROR -DHAVE_SNPRINTF -DMEMMOVE -D__DBINTERFACE_PRIV
ATE  -I../../../dist/WINNT6.1_DBG.OBJ/include -I../../../dist/public/dbm -I../..
/../dist/private/dbm -I../../../dbm/include  /c/Users/Wan-Teh Chang/work/nss-tip
/mozilla/security/dbm/src/../../../dbm/src/db.c
cl : Command line warning D9024 : unrecognized source file type 'c:/Users/Wan-Te
h', object file assumed
cl : Command line warning D9027 : source file 'c:/Users/Wan-Teh' ignored
db.c
c1 : fatal error C1083: Cannot open source file: 'Chang/work/nss-tip/mozilla/sec
urity/dbm/src/../../../dbm/src/db.c': No such file or directory
make[2]: *** [WINNT6.1_DBG.OBJ/db.obj] Error 2
make[2]: Leaving directory `/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security
/dbm/src'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security
/dbm'
make: *** [build_dbm] Error 2

After I added quotes to core_abspath in mozilla/security/coreconf/rules.mk,
the build failed later in mozilla/security/nss/cmd/shlibsign, when the
sign.sh script invoked the shlibsign command using its full pathname, which
contains a space.

cd WINNT6.1_DBG.OBJ ; sh "/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/n
ss/cmd/shlibsign/."/sign.sh "/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/securit
y/nss/cmd/shlibsign/../../../../dist/WINNT6.1_DBG.OBJ" \
        "/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/nss/cmd/shlibsign/
WINNT6.1_DBG.OBJ" WINNT \
        "/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/nss/cmd/shlibsign/
../../../../dist/WINNT6.1_DBG.OBJ/lib" "/c/Users/Wan-Teh Chang/work/nss-tip/mozi
lla/security/nss/cmd/shlibsign/../../../../dist/WINNT6.1_DBG.OBJ/lib/softokn3.dl
l"
/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/nss/cmd/shlibsign/WINNT6.1_
DBG.OBJ/shlibsign -v -i /c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/nss
/cmd/shlibsign/../../../../dist/WINNT6.1_DBG.OBJ/lib/softokn3.dll
/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security/nss/cmd/shlibsign/./sign.sh
: line 22: /c/Users/Wan-Teh: No such file or directory
make[2]: *** [../../../../dist/WINNT6.1_DBG.OBJ/lib/softokn3.chk] Error 127
make[2]: Leaving directory `/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security
/nss/cmd/shlibsign'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/c/Users/Wan-Teh Chang/work/nss-tip/mozilla/security
/nss/cmd'
make: *** [libs] Error 2

Note that the makefile actually passes quoted full pathnames
as command-line arguments to sign.sh, but the quotes are lost
in the ${1}, {2}, etc. shell variables, so sign.sh needs to
quote ${2} and ${5}.  I don't know why sign.sh doesn't need to
quote ${1} and ${4} when it adds ${1} and ${4} to PATH.
Attachment #415646 - Flags: review?(ted.mielczarek)
Also fix the non-Windows code path in sign.sh.
Attachment #415646 - Attachment is obsolete: true
Attachment #415667 - Flags: review?(ted.mielczarek)
Attachment #415646 - Flags: review?(ted.mielczarek)
This patch finishes the job.  Now I can do "make nss_build_all" in
the directory "/Users/wtc/nss tip/mozilla/security/nss" on Mac
OS X.
Attachment #415670 - Flags: review?(ted.mielczarek)
Attachment #415670 - Flags: review?(ted.mielczarek) → review+
Comment on attachment 415667 [details] [diff] [review]
Proposed patch v2

I couldn't find a good explanation in the bash manpage as to why the backtick expansions could contain spaces without extra quoting, but it does work, so I assume it's because the backticks function as a quoting construct.
Attachment #415667 - Flags: review?(ted.mielczarek) → review+
I checked in the patches on the NSS trunk (NSS 3.12.6).

Checking in coreconf/rules.mk;
/cvsroot/mozilla/security/coreconf/rules.mk,v  <--  rules.mk
new revision: 1.82; previous revision: 1.81
done
Checking in nss/cmd/shlibsign/sign.sh;
/cvsroot/mozilla/security/nss/cmd/shlibsign/sign.sh,v  <--  sign.sh
new revision: 1.19; previous revision: 1.18
done
Checking in nss/Makefile;
/cvsroot/mozilla/security/nss/Makefile,v  <--  Makefile
new revision: 1.37; previous revision: 1.36
done
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Latest patch caused build failrues on Linux:

gcc -o accept.o -c      -Wall -pthread -O2 -fPIC  -UDEBUG  -DNDEBUG=1 -DXP_UNIX=1 -D_GNU_SOURCE=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DLINUX=1 -Di386=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -D_REENTRANT=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -I"/.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/security/nss"/../../dist/Linux2.4_x86_glibc_PTH_OPT.OBJ/include -I../../../pr/include -I../../../pr/include/private  ../../../pr/tests/accept.c
gcc  accept.o -Xlinker -rpath /.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/nsprpub/Linux2.4_x86_glibc_PTH_OPT.OBJ/pr/tests/"/.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/security/nss"/../../dist/Linux2.4_x86_glibc_PTH_OPT.OBJ/lib -L"/.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/security/nss"/../../dist/Linux2.4_x86_glibc_PTH_OPT.OBJ/lib -lplc4 -L"/.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/security/nss"/../../dist/Linux2.4_x86_glibc_PTH_OPT.OBJ/lib -lnspr4 -lpthread -o accept
gcc: /.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/nsprpub/Linux2.4_x86_glibc_PTH_OPT.OBJ/pr/tests//.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/security/nss/../../dist/Linux2.4_x86_glibc_PTH_OPT.OBJ/lib: No such file or directory
gmake[1]: *** [accept] Error 1
gmake[1]: Leaving directory `/.automount/guybrush.red.iplanet.com/root/export/mccrel3/security/securitytip/builds/20091207.1/wozzeck_Solaris8/mozilla/nsprpub/Linux2.4_x86_glibc_PTH_OPT.OBJ/pr/tests'
gmake: *** [nspr] Error 2
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 415670 [details] [diff] [review]
Pass quoted path names to NSPR's configure script (backed out)

Slavo, thanks.  I backed out this patch.

The quotes this patch adds to the pathname breaks
the absolute pathname test in
mozilla/nsprpub/pr/tests/Makefile.in:

ifneq ($(OS_ARCH), WINNT)
# Use an absolute pathname as the runtime library path (for the -R
# or -rpath linker option or the LD_RUN_PATH environment variable).
ifeq (,$(patsubst /%,,$(DIST)))
# $(DIST) is already an absolute pathname.
ABSOLUTE_LIB_DIR = $(dist_libdir)
else
# $(DIST) is a relative pathname: prepend the current directory.
PWD = $(shell pwd)
ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir)
endif
endif

It simply tests if the pathname $(DIST) starts with a
slash (/).  With this patch, $(DIST) looks like
"/.automount/guybrush.red.iplanet.com/root/export/mccrel3/..."/...
and starts with a quote, so it fails the absolute
pathname test.

We should be able to fix this by escaping the spaces
in a pathname with backslashes instead of quoting the
pathname, but I don't have time to implement it now.
Attachment #415670 - Attachment description: Pass quoted path names to NSPR's configure script → Pass quoted path names to NSPR's configure script (backed out)
This is CVS output of backing out attachment 415670 [details] [diff] [review].

Checking in Makefile;
/cvsroot/mozilla/security/nss/Makefile,v  <--  Makefile
new revision: 1.38; previous revision: 1.37
done
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.