develooper Front page | perl.perl5.porters | Postings from February 2001

[PATCH] don't write along symlinks into a read only source tree (was Re: [ID 20010129.006] OK: perl v5.7.0 +DEVEL8584 on i586-linux-64all 2.2.12 (UNINSTALLED))

Thread Previous
From:
Nicholas Clark
Date:
February 28, 2001 15:28
Subject:
[PATCH] don't write along symlinks into a read only source tree (was Re: [ID 20010129.006] OK: perl v5.7.0 +DEVEL8584 on i586-linux-64all 2.2.12 (UNINSTALLED))
Message ID:
20010228232849.A55187@plum.flirble.org
On Fri, Feb 09, 2001 at 10:03:33AM -0600, Jarkko Hietaniemi wrote:
> On Mon, Jan 29, 2001 at 07:18:08PM +0000, Nicholas Clark wrote:
> > On Mon, Jan 29, 2001 at 07:09:24PM +0000, nick@babyhippo.com wrote:
> > >     config_args='-Dmksymlinks -Dusedevel -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@talking.bollo.cx -Dperladmin=nick@talking.bollo.cx -Dinc_version_list=  -Dinc_version_list_init=0 -e'
> > 
> > Either mksymlinks wants to copy rather than link to the autogenerated headers,
> > or the actions of make regen_headers (certainly embed.pl) ought to delete
> > their targets before re-opening them.
> > As I'm finding that if I try to make ok in a built directory, make is
> > trying to rebuild everything because some other build directory has
> > just touched the timestamps on files in the source tree.
> > (if not re-written them in a nasty way)
> > 
> > Maybe development tarballs and the rsync server should ship without the
> > autogenerated headers.
> 
> That would be hard to arrange since we need to list the headers in the
> MANIFEST.  Could you experiment with the 'delete the files before
> rebuilding them' approach in embed.pl?

on linux chattr +i * and then I get to see what's trying to write along
the symlinks:

Can't open proto.h: Permission denied at embed.pl line 32.

and

Can't create warnings.h: Permission denied

The following seems to make regen_headers happy with a really read only
source tree:

--- embed.pl.orig	Thu Feb 22 12:31:48 2001
+++ embed.pl	Wed Feb 28 23:14:01 2001
@@ -29,6 +29,7 @@
 	$F = $filename;
     }
     else {
+	unlink $filename;
 	open F, ">$filename" or die "Can't open $filename: $!";
 	$F = \*F;
     }
--- warnings.pl.orig	Fri Dec  8 00:25:51 2000
+++ warnings.pl	Wed Feb 28 23:15:45 2001
@@ -172,8 +172,8 @@
     exit ;
 }
 
-#unlink "warnings.h";
-#unlink "lib/warnings.pm";
+unlink "warnings.h";
+unlink "lib/warnings.pm";
 open(WARN, ">warnings.h") || die "Can't create warnings.h: $!\n";
 open(PM, ">lib/warnings.pm") || die "Can't create lib/warnings.pm: $!\n";
 
 

I'm not totally happy with patching in commented out unlink commands.
I note that embed.pl tries to unlink most things it opens, and all the
other scripts do unlink all the files before they try to open them for
writing.

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About