Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtUtils-CBuilder on Windows does not embed manifests #12003

Closed
p5pRT opened this issue Mar 15, 2012 · 7 comments
Closed

ExtUtils-CBuilder on Windows does not embed manifests #12003

p5pRT opened this issue Mar 15, 2012 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 15, 2012

Migrated from rt.perl.org#111782 (status was 'resolved')

Searchable as RT111782$

@p5pRT
Copy link
Author

p5pRT commented Mar 15, 2012

From Samuel.Ferencik@barclayscapital.com

This is a bug report for perl from sferencik@​gmail.com,
generated with the help of perlbug 1.35 running under perl v5.8.8.


ExtUtils​::CBuilder 0.280205 on Windows tries to embed a manifest into the DLL
that it has just linked, but fails to do so.

The reason is that the embedding is done by the following command​:

  if exist -manifest "XSTest.dll.manifest" mt -nologo -manifest "XSTest.dll.manifest" -outputresource​:"XSTest.dll";2
  ******************************* *******************************
  ^
  +--- the '-manifest' shouldn't be here

The '-manifest' switch after 'if exists' does not make sense, and DOS fails to
process the command. The command should look like so​:

  if exist "XSTest.dll.manifest" mt -nologo -manifest "XSTest.dll.manifest" -outputresource​:"XSTest.dll";2

The command is put together in ExtUtils\CBuilder\Platform\Windows\MSVC.pm.
Obviously, the error is that $spec{manifest} is set to contain the '-manifest'
option, in addition to the manifest filename.

This error was observed when running the tests for ExtUtils​::ParseXS 3.15.



Flags​:
  category=library
  severity=medium


Site configuration information for perl v5.8.8​:

Configured by SYSTEM at Tue Aug 29 12​:39​:43 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration​:
  Platform​:
  osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
  optimize='-MD -Zi -DNDEBUG -O1',
  cppflags='-DWIN32'
  ccversion='12.00.8804', gccversion='', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='link', ldflags ='-nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"C​:\Program Files (x86)\Perl\lib\CORE" -machine​:x86'
  libpth=\lib
  libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib
  perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib
  libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"C​:\Program Files (x86)\Perl\lib\CORE" -machine​:x86'

Locally applied patches​:
  ACTIVEPERL_LOCAL_PATCHES_ENTRY
  Iin_load_module moved for compatibility with build 806
  Avoid signal flag SA_RESTART for older versions of HP-UX
  PerlEx support in CGI​::Carp
  Less verbose ExtUtils​::Install and Pod​::Find
  Patch for CAN-2005-0448 from Debian with modifications
  Rearrange @​INC so that 'site' is searched before 'perl'
  Partly reverted 24733 to preserve binary compatibility
  28671 Define PERL_NO_DEV_RANDOM on Windows
  28376 Add error checks after execing PL_cshname or PL_sh_path
  28305 Pod​::Html should not convert \"foo\" into ``foo''
  27736 Make perl_fini() run with Sun WorkShop compiler
  27619 Bug in Term​::ReadKey being triggered by a bug in Term​::ReadLine
  27549 Move DynaLoader.o into libperl.so
  27528 win32_pclose() error exit doesn't unlock mutex
  27527 win32_async_check() can loop indefinitely
  27515 ignore directories when searching @​INC
  27359 Fix -d​:Foo=bar syntax
  27210 Fix quote typo in c2ph
  27203 Allow compiling swigged C++ code
  27200 Make stat() on Windows handle trailing slashes correctly
  27194 Get perl_fini() running on HP-UX again
  27133 Initialise lastparen in the regexp structure
  27034 Avoid \"Prototype mismatch\" warnings with autouse
  26970 Make Passive mode the default for Net​::FTP
  26921 Avoid getprotobyname/number calls in IO​::Socket​::INET
  26897,26903 Make common IPPROTO_* constants always available
  26670 Make '-s' on the shebang line parse -foo=bar switches
  26536 INSTALLSCRIPT versus INSTALLDIRS
  26379 Fix alarm() for Windows 2003
  26087 Storable 0.1 compatibility
  25861 IO​::File performace issue
  25084 long groups entry could cause memory exhaustion
  24699 ICMP_UNREACHABLE handling in Net​::Ping


@​INC for perl v5.8.8​:
  C​:/Program Files (x86)/Perl/site/lib
  C​:/Program Files (x86)/Perl/lib
  .


Environment for perl v5.8.8​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\Program Files (x86)\Perl\bin\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program Files (x86)\Perforce;c​:\Program Files (x86)\vim\vim73;C​:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C​:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C​:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C​:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C​:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C​:\Program Files (x86)\Barclays Capital\P4CustomTools;C​:\Program Files\Java\jdk1.6.0_21\Bin;C​:\Program Files (x86)\Xoreax\IncrediBuild
  PERL_BADLANG (unset)
  SHELL (unset)

_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link​: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________

@p5pRT
Copy link
Author

p5pRT commented Mar 15, 2012

From @steve-m-hay

Samuel.Ferencik@​barclayscapital.com (via RT) wrote on 2012-03-15​:

# New Ticket Created by Samuel.Ferencik@​barclayscapital.com
# Please include the string​: [perl #111782] # in the subject line of
all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=111782 >

This is a bug report for perl from sferencik@​gmail.com, generated with
the help of perlbug 1.35 running under perl v5.8.8.

-----------------------------------------------------------------

ExtUtils​::CBuilder 0.280205 on Windows tries to embed a manifest into
the DLL that it has just linked, but fails to do so.

The reason is that the embedding is done by the following command​:

if exist \-manifest "XSTest\.dll\.manifest" mt \-nologo \-manifest 

"XSTest.dll.manifest" -outputresource​:"XSTest.dll";2
*******************************
*******************************
^
+--- the '-manifest' shouldn't be here The
'-manifest' switch after 'if exists' does not make sense, and DOS
fails to process the command. The command should look like so​:

if exist "XSTest\.dll\.manifest" mt \-nologo \-manifest 

"XSTest.dll.manifest" -outputresource​:"XSTest.dll";2

The command is put together in
ExtUtils\CBuilder\Platform\Windows\MSVC.pm. Obviously, the error is
that $spec{manifest} is set to contain the '- manifest' option, in
addition to the manifest filename.

Thanks for the report. Something like the patch below should fix this. I will test it properly and apply it later if all is well.

diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
index a847699..3a288a3 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
@​@​ -1,7 +1,7 @​@​
package ExtUtils​::CBuilder​::Platform​::Windows​::MSVC;

use vars qw($VERSION);
-$VERSION = '0.280206';
+$VERSION = '0.280207';

sub arg_exec_file {
  my ($self, $file) = @​_;
@​@​ -64,6 +64,7 @​@​ sub format_linker_cmd {
  }

  my $output = $spec{output};
+ my $manifest = $spec{manifest};

  $spec{def_file} &&= '-def​:' . $spec{def_file};
  $spec{output} &&= '-out​:' . $spec{output};
@​@​ -93,7 +94,7 @​@​ sub format_linker_cmd {

  # Embed the manifest file if it exists
  push @​cmds, [
- 'if', 'exist', $spec{manifest}, 'mt', '-nologo', $spec{manifest}, '-outputresource​:' . "$output;2"
+ 'if', 'exist', $manifest, 'mt', '-nologo', $spec{manifest}, '-outputresource​:' . "$output;2"
  ];

  return @​cmds;

@p5pRT
Copy link
Author

p5pRT commented Mar 15, 2012

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2012

From @steve-m-hay

Samuel.Ferencik@​barclayscapital.com wrote on 2012-03-16​:

-----Original Message-----
From​: Steve Hay via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Thursday, March 15, 2012 5​:04 PM
To​: Ferencik, Samuel​: Markets (PRG)
Subject​: RE​: [perl #111782] ExtUtils-CBuilder on Windows does not
embed manifests

Samuel.Ferencik@​barclayscapital.com (via RT) wrote on 2012-03-15​:

# New Ticket Created by Samuel.Ferencik@​barclayscapital.com
# Please include the string​: [perl #111782] # in the subject line
of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=111782 >

This is a bug report for perl from sferencik@​gmail.com, generated with
the help of perlbug 1.35 running under perl v5.8.8.

-----------------------------------------------------------------

ExtUtils​::CBuilder 0.280205 on Windows tries to embed a manifest
into the DLL that it has just linked, but fails to do so.

The reason is that the embedding is done by the following command​:

if exist \-manifest "XSTest\.dll\.manifest" mt \-nologo \-manifest

"XSTest.dll.manifest" -outputresource​:"XSTest.dll";2
*******************************
*******************************
^
+--- the '-manifest' shouldn't be here The
'-manifest' switch after 'if exists' does not make sense, and DOS
fails to process the command. The command should look like so​:

if exist "XSTest\.dll\.manifest" mt \-nologo \-manifest

"XSTest.dll.manifest" -outputresource​:"XSTest.dll";2

The command is put together in
ExtUtils\CBuilder\Platform\Windows\MSVC.pm. Obviously, the error is
that $spec{manifest} is set to contain the '- manifest' option, in
addition to the manifest filename.

Thanks for the report. Something like the patch below should fix this.
I will test it properly and apply it later if all is well.

diff --git a/dist/ExtUtils-
CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.p m
index a847699..3a288a3 100644 --- a/dist/ExtUtils-
CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm +++
b/dist/ExtUtils- CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC
+++ .pm @​@​ -1,7 +1,7 @​@​
package ExtUtils​::CBuilder​::Platform​::Windows​::MSVC;

use vars qw($VERSION);
-$VERSION = '0.280206';
+$VERSION = '0.280207';

sub arg_exec_file {
my ($self, $file) = @​_; @​@​ -64,6 +64,7 @​@​ sub format_linker_cmd { }

my $output = $spec{output};
+ my $manifest = $spec{manifest};

$spec{def_file} &&= '-def​:' . $spec{def_file};
$spec{output} &&= '-out​:' . $spec{output};
@​@​ -93,7 +94,7 @​@​ sub format_linker_cmd {

# Embed the manifest file if it exists
push @​cmds, [
- 'if', 'exist', $spec{manifest}, 'mt', '-nologo', $spec{manifest},
'-outputresource​:' . "$output;2"
+ 'if', 'exist', $manifest, 'mt', '-nologo', $spec{manifest}, '-
outputresource​:' . "$output;2"
];

return @​cmds;
Hi Steve,

Thanks for the quick response. I can't create a patch here at work,
but I wonder if it would be more appropriate to take out the '-manifest'
out of $spec{manifest} completely, so we would have​:

push @​cmds, [
'if', 'exist', $spec{manifest}, 'mt', '-nologo', '-manifest',
$spec{manifest}, '-outputresource​:' . "$output;2"
];
The string "manifest" is only used in two files (which makes sense
given this is a Windows mechanism)​:
- ExtUtils\CBuilder\Platform\Windows.pm
- ExtUtils\CBuilder\Platform\Windows\MSVC.pm
It seems that the '-manifest' option should only be included for the
call to mt.exe. In any other context (see add_to_cleanup(),
normalize_filespecs() in Windows.pm) it's only going to cause
trouble... (I haven't investigated this in detail, but I guess that
somewhere down the line add_to_cleanup() and normalize_filespecs()
would perform file operations with "-manifest a.dll.manifest" instead
of just "a.dll.manifest".)

I think my original patch should be fine. It just does the same for "manifest" as is already done for "output". The list of files to cleanup is added to in link() in the Windows.pm file, and that happens immediately after the filenames have been defined, well before anything is called which prepends strings like "-manifest " to them, so the correct (bare) filename does get cleaned up correctly.

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

From @steve-m-hay

Now applied to blead as #c2f56b9483.

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

From [Unknown Contact. See original ticket]

Now applied to blead as #c2f56b9483.

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

@steve-m-hay - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant