bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] src/makefile.w32-in


From: Bill Meier
Subject: Re: [PATCH] src/makefile.w32-in
Date: Sun, 20 Jan 2008 11:30:21 -0500
User-agent: Thunderbird 2.0.0.9 (X11/20071115)

Jason Rumney wrote:
I'm confused, what permissions are you talking about? Windows does not use POSIX permissions, all readable .exe files are considered executable.

I'm not really familiar with the details of Windows file permissions
so the easiest way for me to respond is to say that in
my Windows environment (see below) a 'mingw32-make clean'
followed by a 'mingw32-make' fails with a
'permission denied' for temacs.exe.

###Annotated)
  $mingw32-make clean
  <snip>
  $mingw32-make
  <snip>
"../nt/oo-spd/i386/addsection" "oo-spd/i386/temacs.bin" "oo-spd/i386/temacs.exe" EMHEAP 16
  Dumping from oo-spd/i386/temacs.bin
            to oo-spd/i386/temacs.exe
  echo oo-spd/i386/emacs.o > oo-spd/i386/buildobj.lst
  <snip>
  "./oo-spd/i386/temacs.exe" -batch -l loadup dump
  /usr/bin/sh: ./oo-spd/i386/temacs.exe: Permission denied
  mingw32-make[1]: *** [oo-spd/i386/emacs.exe] Error 126
  mingw32-make[1]: Leaving directory `C:/emacs-22.1.1/src'
  mingw32-make: *** [all-other-dirs-gmake] Error 2

  ### The following shows the 'permissions' of temacs.exe at
  ### this point
  $cacls c:\emacs-22.1.1\src\oo-spd\i386\temacs.exe
  c:\emacs-22.1.1\src\oo-spd\i386\temacs.exe xxx\wmeier:(special access:)
                          STANDARD_RIGHTS_ALL
                          DELETE
                          READ_CONTROL
                          WRITE_DAC
                          WRITE_OWNER
                          SYNCHRONIZE
                          STANDARD_RIGHTS_REQUIRED
                          FILE_GENERIC_READ
                          FILE_GENERIC_WRITE
                          FILE_READ_DATA
                          FILE_WRITE_DATA
                          FILE_APPEND_DATA
                          FILE_READ_EA
                          FILE_WRITE_EA
                          FILE_READ_ATTRIBUTES
                          FILE_WRITE_ATTRIBUTES

            BUILTIN\Users:(special access:)
                          READ_CONTROL
                          SYNCHRONIZE
                          FILE_GENERIC_READ
                          FILE_GENERIC_WRITE
                          FILE_READ_DATA
                          FILE_WRITE_DATA
                          FILE_APPEND_DATA
                          FILE_READ_EA
                          FILE_WRITE_EA
                          FILE_READ_ATTRIBUTES
                          FILE_WRITE_ATTRIBUTES

            Everyone:(special access:)
                     READ_CONTROL
                     SYNCHRONIZE
                     FILE_GENERIC_READ
                     FILE_GENERIC_WRITE
                     FILE_READ_DATA
                     FILE_WRITE_DATA
                     FILE_APPEND_DATA
                     FILE_READ_EA
                     FILE_WRITE_EA
                     FILE_READ_ATTRIBUTES
                     FILE_WRITE_ATTRIBUTES

-------------------------------------------------------------
My environment (which I think is nothing out of the ordinary)
   Windows XP (patched) using NTFS file structure
   MinGW (for gcc, mingw32-make & etc)
   Cygwin (for bash & etc)

-------------------------------------------------------------
As described previously, some poking around shows that the
problem is due to the fact that a dummy temacs.exe file
without 'execute' permission exists
when addsection is run in src/makefile.
The dummy file is created in lib-src/makefile.
The simple solution to the problem is to delete the dummy file
just before runing addsection to create the real
temacs.exe.

I've attached a patch to do this against the EMACS_22_BASE src/makefile.w32-in

=============================================================

### Some gory details
### Demonstration of the problem
###

### Create dummy temacs.exe and then run addsection;
###  Then: Cannot execute temacs.exe

$ cd c:\emacs-22.1\src
$bash
bash-3.2$ echo temacs > oo-spd/i386/temacs.exe
bash-3.2$ cacls oo-spd/i386/temacs.exe
C:\emacs-22.1.1\src\oo-spd\i386\temacs.exe xxx\wmeier:(special access:)
                           STANDARD_RIGHTS_ALL
                           DELETE
                           READ_CONTROL
                           WRITE_DAC
                           WRITE_OWNER
                           SYNCHRONIZE
                           STANDARD_RIGHTS_REQUIRED
                           FILE_GENERIC_READ
                           FILE_GENERIC_WRITE
                           FILE_READ_DATA
                           FILE_WRITE_DATA
                           FILE_APPEND_DATA
                           FILE_READ_EA
                           FILE_WRITE_EA
                           FILE_READ_ATTRIBUTES
                           FILE_WRITE_ATTRIBUTES

             BUILTIN\Users:(special access:)
                           READ_CONTROL
                           SYNCHRONIZE
                           FILE_GENERIC_READ
                           FILE_GENERIC_WRITE
                           FILE_READ_DATA
                           FILE_WRITE_DATA
                           FILE_APPEND_DATA
                           FILE_READ_EA
                           FILE_WRITE_EA
                           FILE_READ_ATTRIBUTES
                           FILE_WRITE_ATTRIBUTES

             Everyone:(special access:)
                      READ_CONTROL
                      SYNCHRONIZE
                      FILE_GENERIC_READ
                      FILE_GENERIC_WRITE
                      FILE_READ_DATA
                      FILE_WRITE_DATA
                      FILE_APPEND_DATA
                      FILE_READ_EA
                      FILE_WRITE_EA
                      FILE_READ_ATTRIBUTES
                      FILE_WRITE_ATTRIBUTES


bash-3.2$ "../nt/oo-spd/i386/addsection" "oo-spd/i386/temacs.bin" "oo-spd/i386/temacs.exe" EMHEAP 16
Dumping from oo-spd/i386/temacs.bin
          to oo-spd/i386/temacs.exe

bash-3.2$ ./oo-spd/i386/temacs.exe -l -batch loadup dump
bash: ./oo-spd/i386/temacs.exe: Permission denied

bash-3.2$ cacls oo-spd/i386/temacs.exe
C:\emacs-22.1.1\src\oo-spd\i386\temacs.exe xxx\wmeier:(special access:)
                           STANDARD_RIGHTS_ALL
                           DELETE
                           READ_CONTROL
                           WRITE_DAC
                           WRITE_OWNER
                           SYNCHRONIZE
                           STANDARD_RIGHTS_REQUIRED
                           FILE_GENERIC_READ
                           FILE_GENERIC_WRITE
                           FILE_READ_DATA
                           FILE_WRITE_DATA
                           FILE_APPEND_DATA
                           FILE_READ_EA
                           FILE_WRITE_EA
                           FILE_READ_ATTRIBUTES
                           FILE_WRITE_ATTRIBUTES

             BUILTIN\Users:(special access:)
                           READ_CONTROL
                           SYNCHRONIZE
                           FILE_GENERIC_READ
                           FILE_GENERIC_WRITE
                           FILE_READ_DATA
                           FILE_WRITE_DATA
                           FILE_APPEND_DATA
                           FILE_READ_EA
                           FILE_WRITE_EA
                           FILE_READ_ATTRIBUTES
                           FILE_WRITE_ATTRIBUTES

             Everyone:(special access:)
                      READ_CONTROL
                      SYNCHRONIZE
                      FILE_GENERIC_READ
                      FILE_GENERIC_WRITE
                      FILE_READ_DATA
                      FILE_WRITE_DATA
                      FILE_APPEND_DATA
                      FILE_READ_EA
                      FILE_WRITE_EA
                      FILE_READ_ATTRIBUTES
                      FILE_WRITE_ATTRIBUTES

### Creating temacs.exe in the absence of the dummy file
###  works AOK

bash-3.2$ rm oo-spd/i386/temacs.exe
bash-3.2$ "../nt/oo-spd/i386/addsection" "oo-spd/i386/temacs.bin" "oo-spd/i386/temacs.exe" EMHEAP 16
Dumping from oo-spd/i386/temacs.bin
          to oo-spd/i386/temacs.exe
bash-3.2$ ./oo-spd/i386/temacs.exe -l -batch loadup dump
bash-3.2$ cacls oo-spd/i386/temacs.exe

C:\emacs-22.1.1\src\oo-spd\i386\temacs.exe xxx\wmeier:F
             BUILTIN\Users:(special access:)
                           READ_CONTROL
                           SYNCHRONIZE
                           FILE_GENERIC_READ
                           FILE_GENERIC_WRITE
                           FILE_GENERIC_EXECUTE
                           FILE_READ_DATA
                           FILE_WRITE_DATA
                           FILE_APPEND_DATA
                           FILE_READ_EA
                           FILE_WRITE_EA
                           FILE_EXECUTE
                           FILE_DELETE_CHILD
                           FILE_READ_ATTRIBUTES
                           FILE_WRITE_ATTRIBUTES

             Everyone:(special access:)
                      READ_CONTROL
                      SYNCHRONIZE
                      FILE_GENERIC_READ
                      FILE_GENERIC_WRITE
                      FILE_GENERIC_EXECUTE
                      FILE_READ_DATA
                      FILE_WRITE_DATA
                      FILE_APPEND_DATA
                      FILE_READ_EA
                      FILE_WRITE_EA
                      FILE_EXECUTE
                      FILE_DELETE_CHILD
                      FILE_READ_ATTRIBUTES
                      FILE_WRITE_ATTRIBUTES


--- src\makefile.w32-in-orig    2008-01-20 10:24:26.150886400 -0500
+++ src\makefile.w32-in 2008-01-20 10:29:14.345289600 -0500
@@ -168,11 +168,16 @@
 # Note the extra post-link step to insert a static preload heap section.
 # If preload runs out of memory, increase the last argument to addsection
 # (it is the preload heap size in MB).
+# Note that a (possibly dummy) temacs.exe is deleted before the post-link step.
+#  This is required so that the permissions for the new temacs.exe are not 
inherited
+#  from an existing one (which might not have 'executable' permission). 
+#  (See lib-src makefile).
 #
 temacs:         stamp_BLD $(TEMACS)
 $(TEMACS):      $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \
                  ../nt/$(BLD)/addsection.exe
        $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) 
$(LIBS)
+       - $(DEL) "$(TEMACS)"
        "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16
        echo $(OBJ0) > $(BLD)/buildobj.lst
        echo $(OBJ1) >> $(BLD)/buildobj.lst

reply via email to

[Prev in Thread] Current Thread [Next in Thread]