Hi.
In the past Cygwin was necessary to build PHP documentation. It isn't
anymore, but I've still got it on my machine.
The current Makefile template for win32 build of PHP uses rmdir, which
is being detected as an executable. This is probably nmake's fault as
rmdir at the command line will use the built-in one first.
The attached patch forces the use of 'rd' rather than 'rmdir'.
Cygwin's rmdir.exe doesn't support /s or /q
Windows rd does.
Obviously no cygwin === no rmdir rename required.
Richard.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
On Wed, May 7, 2008 at 6:42 PM, Richard Quadling
rquadling@googlemail.com wrote:
Hi.
[..]
The attached patch forces the use of 'rd' rather than 'rmdir'.
Only plain/text attachments get through the list..
-Hannes
2008/5/7 Hannes Magnusson hannes.magnusson@gmail.com:
On Wed, May 7, 2008 at 6:42 PM, Richard Quadling
rquadling@googlemail.com wrote:Hi.
[..]The attached patch forces the use of 'rd' rather than 'rmdir'.
Only plain/text attachments get through the list..
-Hannes
Basically search&replace rmdir with rd in the win32/build/Makefile
Index: Makefile
RCS file: /repository/php-src/win32/build/Makefile,v
retrieving revision 1.35.2.1.2.6.2.4
diff -u -u -r1.35.2.1.2.6.2.4 Makefile
--- Makefile 3 May 2008 21:12:55 -0000 1.35.2.1.2.6.2.4
+++ Makefile 7 May 2008 16:16:31 -0000
@@ -100,15 +100,15 @@
@echo Cleaning distribution build dirs
@for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D*.* > NUL
-@del /F /Q $(BUILD_DIR)*.res $(BUILD_DIR)*.lib $(BUILD_DIR)*.ilk
$(BUILD_DIR)*.pdb $(BUILD_DIR)*.exp $(PHPDEF)
$(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip
$(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL
- -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
- -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
clean-pecl:
@echo Cleaning PECL targets only
- -rmdir /s /q $(BUILD_DIR)\pecl
- -rd /s /q $(BUILD_DIR)\pecl
clean-all:
@echo Cleaning standard build dirs
- @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rmdir /s /q %D
- @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D
-@del /f /q $(BUILD_DIR)*.res $(BUILD_DIR)*.lib $(BUILD_DIR)*.ilk
$(BUILD_DIR)*.pdb $(BUILD_DIR)*.exp $(PHPDEF) $(BUILD_DIR)*.rc
$(BUILD_DIR)*.dbg $(BUILD_DIR)*.bin $(BUILD_DIR)\php*.dll
$(BUILD_DIR)\php*.exe > NUL
test:
@@ -124,8 +124,8 @@
-for %T in ($(PECL_TARGETS)) do $(MAKE) /I /nologo "%T"
build-dist: $(BUILD_DIR)\deplister.exe
- -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
- -rmdir /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
- -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
- -rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
-del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip
-del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)-Win32.zip
-del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Hi Richard,
Basically search&replace rmdir with rd in the win32/build/Makefile
Why? rd's just an alias of rmdir, and rmdir's the more human-readable of the
two.
- Steph
2008/5/8 Steph Fox steph@zend.com:
Hi Richard,
Basically search&replace rmdir with rd in the win32/build/Makefile
Why? rd's just an alias of rmdir, and rmdir's the more human-readable of the
two.
- Steph
If only I could send the sound of my shoulders slumping as yet another
post is ignored/filtered. http://news.php.net/php.internals/37517
I truly believe that no one on this list reads my emails or
automatically filters them. If you want to just f*ck off, then say so.
As I said in the original post, if you have cygwin installed (as was
needed to build the PHP documentation in the bad old days before phd),
then rmdir.exe would be in your path).
It seems that nmake follows the path BEFORE using the shell. My proof
is that cygwin's rmdir.exe is executed. If I rename it then the
shell's rmdir is used. Revert the rename and cygwin's rmdir.exe is
executed. Simple.
cygwin's rmdir.exe doesn't support /s or /q so this when you try to
run nmake clean(xxxx) you get an error from rmdir.exe and no cleaning.
I could rename cygwin's rmdir, but then all my script relying on
rmdir.exe's behaviour fail (windows rd doesn't support --parents
--ignore-fail-on-non-empty, etc).
By using rd, this isn't found in the path by nmake and runs correctly
with the windows/dos options.
You can use filemon to see nmake hunting for rmdir.xxx where xxx is
the contents of PATHEXT in each PATH.
Richard.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
If only I could send the sound of my shoulders slumping as yet another
post is ignored/filtered. http://news.php.net/php.internals/37517
I only asked why :)
As I said in the original post, if you have cygwin installed (as was
needed to build the PHP documentation in the bad old days before phd),
then rmdir.exe would be in your path).
Wouldn't having /cygwin/bin permanently in your PATH screw up native
executables throughout? Can you use MS rmdir on your system at all?
Aren't you running vcvars32.bat before you hit nmake? Or do you have MS
headers permanently in your PATH too?
- Steph
2008/5/8 Steph Fox steph@zend.com:
If only I could send the sound of my shoulders slumping as yet another
post is ignored/filtered. http://news.php.net/php.internals/37517I only asked why :)
As I said in the original post, if you have cygwin installed (as was
needed to build the PHP documentation in the bad old days before phd),
then rmdir.exe would be in your path).Wouldn't having /cygwin/bin permanently in your PATH screw up native
executables throughout? Can you use MS rmdir on your system at all?
No. As in normal windows, shell commands take precedence over
programs/scripts, even with the same name. If I want to use a cygwin
program in preference to a windows one, then I will either delete or
rename the windows one. If I can't do that, then I will put the cygwin
version in a tools directory which is in the path before windows, et
al.
rmdir does not exist as an "executable" in windows/dos. It is part of
the shell (command.com/cmd.exe). There is no "program" (or script or
anything) called rmdir.anything.
Here is some steps I've taken to show the problem. If you don't have
cygwin in your path, then this isn't an issue. But I do and I use
cygwin tools all day. This patch removes the problem. For the last 20
years of software development, I've always used md/cd/rd rather than
mkdir/chdir/rmdir. In windows they are the same thing.
Find all rmdir.somethings in the path.
2008/05/09 11:11:07 C:>whereis rmdir
Directory Found (Date and Size)
============= ===========================
D:\Cygwin\bin rmdir.EXE 2008-01-24 43,008
Let's see the builtin help for rmdir.
2008/05/09 11:11:22 C:>rmdir /?
Removes (deletes) a directory.
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
Let's see cygwin's help for rmdir - notice no support for /s or /q.
2008/05/09 11:11:26 C:>d:\cygwin\bin\rmdir --help
Usage: /usr/bin/rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
--ignore-fail-on-non-empty
ignore each failure that is solely because a directory
is non-empty
-p, --parents Remove DIRECTORY and its ancestors. E.g., rmdir -p a/b/c' is similar to
rmdir a/b/c a/b a'.
-v, --verbose output a diagnostic for every directory processed
--help display this help and exit
--version output version information and exit
Report bugs to bug-coreutils@gnu.org.
Create a directory and remove it using /s.
2008/05/09 11:11:30 C:>md bob
2008/05/09 11:11:34 C:>rmdir /s bob
bob, Are you sure (Y/N)? y
Now repeat with cygwin's rmdir.exe
2008/05/09 11:11:41 C:>md bob
2008/05/09 11:11:43 C:>d:\cygwin\bin\rmdir.exe /s bob
/usr/bin/rmdir: failed to remove `/s': No such file or directory
If I run nmake clean-all inside my vcvars32.bat environment, I get the
cygwin error.
If I run filemon it shows nmake hunting through my path looking for
rmdir.xxx where xxx is one of my extensions in PATHEXT
(PATHEXT=.COM;.EXE;.BAT;.CMD;.PHP;.PYC;.PY;;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW).
Effectively nmake is not respecting the shell to run internal commands.
As you can see (hopefully), rmdir is a SHELL command, even if an
executable exists with the same name and that executable is in the
path.
The issue is that nmake doesn't respect the shell command until after
it has done the search via the path.
Even with cygwin in the path, I have no problem running windows shell
scripts. I even sometimes use cygwin executable as they do things
differently or provide facilities windows don't have (tiff tools for
example).
Aren't you running vcvars32.bat before you hit nmake? Or do you have MS
headers permanently in your PATH too?
Yes I am. But that only adds a few env vars. It doesn't remove cygwin
from the path (and why should it).
This is an edited diff of my environments (normal vs vccars32.bat)
--- out.txt 2008-05-09 11:03:16.616418300 +0100
+++ in.txt 2008-05-09 11:03:22.397668300 +0100
@@ -5,14 +5,21 @@
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=RICHARDQUADLING
ComSpec=C:\WINDOWS\system32\cmd.exe
+DevEnvDir=C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
DIRCMD=/A /C /4 /OGEN /N,
FP_NO_HOST_CHECK=NO
+Framework35Version=v3.5
+FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
+FrameworkVersion=v2.0.50727
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\RichardQ
+INCLUDE=C:\Program Files\Microsoft Visual Studio
9.0\VC\INCLUDE;C:\Program Files\Microsoft SDKs\Windows\v6.1\include;
+LIB=C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;C:\Program
Files\Microsoft SDKs\Windows\v6.1\lib;
+LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program
Files\Microsoft Visual Studio 9.0\VC\LIB;
LOGONSERVER=\xxxxxxxx
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
-Path=[SNIPPED]
+Path=C:\Work\php_build\bin;C:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN;C:\Program Files\Microsoft Visual Studio
9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program
Files\Microsoft Visual Studio 9.0\VC\VCPackages;C:\Program
Files\Microsoft SDKs\Windows\v6.1\bin;[SNIPPED]
PATHEXT=.COM;.EXE;.BAT;.CMD;.PHP;.PYC;.PY;;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW
PATHEXTORIG=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PHP_PEAR_BIN_DIR=C:\PEAR
@@ -40,5 +47,8 @@
USERDOMAIN=xxxxxxxx
USERNAME=RichardQ
USERPROFILE=C:\Documents and Settings\RichardQ
+VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0\VC
VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools
+VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0
windir=C:\WINDOWS
+WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.1\
- Steph
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Hi Richard,
Wouldn't having /cygwin/bin permanently in your PATH screw up native
executables throughout? Can you use MS rmdir on your system at all?No. As in normal windows, shell commands take precedence over
programs/scripts, even with the same name. If I want to use a cygwin
program in preference to a windows one, then I will either delete or
rename the windows one. If I can't do that, then I will put the cygwin
version in a tools directory which is in the path before windows, et
al.rmdir does not exist as an "executable" in windows/dos. It is part of
the shell (command.com/cmd.exe). There is no "program" (or script or
anything) called rmdir.anything.
... that's what 'alias' means.
Here is some steps I've taken to show the problem. If you don't have
cygwin in your path, then this isn't an issue. But I do and I use
cygwin tools all day. This patch removes the problem. For the last 20
years of software development, I've always used md/cd/rd rather than
mkdir/chdir/rmdir. In windows they are the same thing.
Eh, I'm just trying to figure out whether that conflict's specific to your
setup or not. Don't take it personally ;) but if it's an issue for all,
sure, the patch goes in. If it's just you, it probably doesn't.
I uninstalled cygwin about 5 weeks ago when I had a stuffed hard disk, so I
can't check for myself what happens with PATH and cygwin. I didn't have any
problems with it when it was there, just - as you say - it's not essential
for docs any more, and that's about all I used it for.
We need someone else to confirm/deny.
- Steph
2008/5/9 Steph Fox steph@zend.com:
Hi Richard,
Wouldn't having /cygwin/bin permanently in your PATH screw up native
executables throughout? Can you use MS rmdir on your system at all?No. As in normal windows, shell commands take precedence over
programs/scripts, even with the same name. If I want to use a cygwin
program in preference to a windows one, then I will either delete or
rename the windows one. If I can't do that, then I will put the cygwin
version in a tools directory which is in the path before windows, et
al.rmdir does not exist as an "executable" in windows/dos. It is part of
the shell (command.com/cmd.exe). There is no "program" (or script or
anything) called rmdir.anything.... that's what 'alias' means.
Here is some steps I've taken to show the problem. If you don't have
cygwin in your path, then this isn't an issue. But I do and I use
cygwin tools all day. This patch removes the problem. For the last 20
years of software development, I've always used md/cd/rd rather than
mkdir/chdir/rmdir. In windows they are the same thing.Eh, I'm just trying to figure out whether that conflict's specific to your
setup or not. Don't take it personally ;) but if it's an issue for all,
sure, the patch goes in. If it's just you, it probably doesn't.I uninstalled cygwin about 5 weeks ago when I had a stuffed hard disk, so I
can't check for myself what happens with PATH and cygwin. I didn't have any
problems with it when it was there, just - as you say - it's not essential
for docs any more, and that's about all I used it for.We need someone else to confirm/deny.
- Steph
You don't actually need to install cygwin to see the fault.
Create a batch file called rmdir.bat like this ...
@ECHO OFF
ECHO You are running %0
ECHO The parameters you supplied are:
ECHO 1 : %1
ECHO 2 : %2
ECHO 3 : %3
ECHO 4 : %4
ECHO 5 : %5
PAUSE
Place this in your path. Put it in the last directory in your path. My
last path entry happens to be a common folder for Nero. (C:\Program
Files\Common Files\Ahead\Lib".
I've renamed the cygwin folder. I put the above batch file in the
common folder location.
vcvars32.bat'd myself.
name clean-pecl
Outputs ...
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
2008/05/09 11:55:44 C:\Work\php-src-PHP_5_3>nmake clean-pecl
Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
Cleaning PECL targets only
rmdir /s /q Release_TS\pecl
You are running "C:\Program Files\Common Files\Ahead\Lib\rmdir.BAT"
The parameters you supplied are:
1 : /s
2 : /q
3 : Release_TS\pecl
4 :
5 :
Press any key to continue . . .
Remove rmdir.bat and all works as expected.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Richard Quadling wrote:
You don't actually need to install cygwin to see the fault.
Create a batch file called rmdir.bat like this ...
But this is not what you have in the production makefile environment.
Here is a quick test. Create a simple makefile in your home folder. for
me, it is:
g:/cygwin/home/administrator
Makefile has:
-----------------------
all: clean
clean:
@echo hello world
@md bob
-rmdir bob /q /s
-----------------------
I can run this under a cygwin shell or a normal DOS BOX and it works fine.
However, I agree if you type RMDIR from within a cygwin shell, then it
will use the EXE version found in the bin folder which is incompatible
with the Windows RMDIR/RD shell commands, switch wise.
--
Hector Santos
2008/5/9 Hector Santos hsantos@isdg.net:
Richard Quadling wrote:
You don't actually need to install cygwin to see the fault.
Create a batch file called rmdir.bat like this ...
But this is not what you have in the production makefile environment.
Here is a quick test. Create a simple makefile in your home folder. for me,
it is:g:/cygwin/home/administrator
Makefile has:
-----------------------
all: clean
clean:
@echo hello world
@md bob
-rmdir bob /q /s-----------------------
I can run this under a cygwin shell or a normal DOS BOX and it works fine.
However, I agree if you type RMDIR from within a cygwin shell, then it will
use the EXE version found in the bin folder which is incompatible with the
Windows RMDIR/RD shell commands, switch wise.--
Hector Santos
Can you build a really simple makefile and run it using nmake?
nmake is the issue as it is not using the shell first. It is looking
for executables via the path. System Internal's FileMonitor shows
this.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Richard Quadling wrote:
2008/5/9 Hector Santos hsantos@isdg.net:
nmake is the issue as it is not using the shell first. It is looking
for executables via the path. System Internal's FileMonitor shows
this.
I can confirm that nmake v6 from VS C/C++ 6.00 did not exhibit the
problem. However nnake (v8) from VS 2005 does exhibit the problem.
Richard was using nmake v9 (VS 2008).
The problem begins with having /cygwin/bin folder in the PATH statement
and RMDIR.EXE found in this folder by nmake (v8, v9).
--
Hector Santos
Hi Hector,
I can confirm that nmake v6 from VS C/C++ 6.00 did not exhibit the
problem. However nnake (v8) from VS 2005 does exhibit the problem.
Richard was using nmake v9 (VS 2008).The problem begins with having /cygwin/bin folder in the PATH statement
and RMDIR.EXE found in this folder by nmake (v8, v9).
That would explain why I thought it was something in his setup :) thank you
for clearing up the mystery.
I committed Richard's changes in 5_3 branch (only, for now) yesterday.
Wietse may well be correct about the explicit cmd /c being more robust, but
posted after that commit.
- Steph