Discussion:
Problem with MSVC install script
Chuck McDevitt
2007-09-24 01:50:53 UTC
Permalink
I was trying out the msvc support, and ran into a minor problem in the
install.bat/install.pl



If any files that are going to be installed are marked read-only, they
carry the read-only attribute with them when they get copied to the
install dir.



Then, if you try to run install again, the new attempt will fail because
it can't overwrite the read-only file.



I added this like to install.bat (just before the call to install.pl) to
fix this for me:



attrib /S -r %1\*
Andrew Dunstan
2007-09-24 02:44:51 UTC
Permalink
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem in the
install.bat/install.pl
If any files that are going to be installed are marked read-only, they
carry the read-only attribute with them when they get copied to the
install dir.
Then, if you try to run install again, the new attempt will fail
because it can’t overwrite the read-only file.
I added this like to install.bat (just before the call to install.pl)
attrib /S -r %1\*
Which files are read-only?

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq
Chuck McDevitt
2007-09-24 06:59:54 UTC
Permalink
Well, I was checking out from a different cvs server, and had things set
to use CVS EDIT, where everything is read-only by default, until you
issue a cvs edit command.
So many files that aren't built by the build system, but just get copied
as-is, end up read-only.

But it would be true for any files set read-only.
-----Original Message-----
Sent: Sunday, September 23, 2007 7:45 PM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem in
the
Post by Chuck McDevitt
install.bat/install.pl
If any files that are going to be installed are marked read-only,
they
Post by Chuck McDevitt
carry the read-only attribute with them when they get copied to the
install dir.
Then, if you try to run install again, the new attempt will fail
because it can't overwrite the read-only file.
I added this like to install.bat (just before the call to
install.pl)
Post by Chuck McDevitt
attrib /S -r %1\*
Which files are read-only?
cheers
andrew
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly
Magnus Hagander
2007-09-24 07:33:23 UTC
Permalink
Hrrm. I wonder how likely that is, but I can see it's a problem.

That said, it's probably not a bad idea to fix it anyway - it would
correspond to setting the permissions on a unix install, which we do.

For the xcopy commansd, it should be easier to just add a /R switch. But
most files are copied using the internal perl stuff - anybody know if those
can be made to overwrite readonly files easily?

Also, do we really want to remove the readonly file on all the files in the
target dir including subdirs? That may hit a bunch of files that aren't
actualliy "ours". Perhaps we need to process it on a file-by-file basis?

//Magnus
Post by Chuck McDevitt
Well, I was checking out from a different cvs server, and had things set
to use CVS EDIT, where everything is read-only by default, until you
issue a cvs edit command.
So many files that aren't built by the build system, but just get copied
as-is, end up read-only.
But it would be true for any files set read-only.
-----Original Message-----
Sent: Sunday, September 23, 2007 7:45 PM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem in
the
Post by Chuck McDevitt
install.bat/install.pl
If any files that are going to be installed are marked read-only,
they
Post by Chuck McDevitt
carry the read-only attribute with them when they get copied to the
install dir.
Then, if you try to run install again, the new attempt will fail
because it can't overwrite the read-only file.
I added this like to install.bat (just before the call to
install.pl)
Post by Chuck McDevitt
attrib /S -r %1\*
Which files are read-only?
cheers
andrew
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
message can get through to the mailing list cleanly
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Chuck McDevitt
2007-09-24 17:23:28 UTC
Permalink
Of course it is better not to remove the readonly on all files in the
target dir. That's just a workaround I did because it didn't involve
changing the perl scripts.
I don't know the "right" perl way to change the readonly attribute on a
file. If there isn't one, you could have the perl code issue "attrib"
commands on the target location for each file it is moving. Better if
there is some more "perl" way to do this.
-----Original Message-----
Sent: Monday, September 24, 2007 12:33 AM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Hrrm. I wonder how likely that is, but I can see it's a problem.
That said, it's probably not a bad idea to fix it anyway - it would
correspond to setting the permissions on a unix install, which we do.
For the xcopy commansd, it should be easier to just add a /R switch. But
most files are copied using the internal perl stuff - anybody know if those
can be made to overwrite readonly files easily?
Also, do we really want to remove the readonly file on all the files
in
the
target dir including subdirs? That may hit a bunch of files that aren't
actualliy "ours". Perhaps we need to process it on a file-by-file basis?
//Magnus
Post by Chuck McDevitt
Well, I was checking out from a different cvs server, and had things
set
Post by Chuck McDevitt
to use CVS EDIT, where everything is read-only by default, until you
issue a cvs edit command.
So many files that aren't built by the build system, but just get
copied
Post by Chuck McDevitt
as-is, end up read-only.
But it would be true for any files set read-only.
-----Original Message-----
Sent: Sunday, September 23, 2007 7:45 PM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem
in
Post by Chuck McDevitt
the
Post by Chuck McDevitt
install.bat/install.pl
If any files that are going to be installed are marked
read-only,
Post by Chuck McDevitt
they
Post by Chuck McDevitt
carry the read-only attribute with them when they get copied to
the
Post by Chuck McDevitt
Post by Chuck McDevitt
install dir.
Then, if you try to run install again, the new attempt will fail
because it can't overwrite the read-only file.
I added this like to install.bat (just before the call to
install.pl)
Post by Chuck McDevitt
attrib /S -r %1\*
Which files are read-only?
cheers
andrew
---------------------------(end of
broadcast)------------------------
---
Post by Chuck McDevitt
TIP 1: if posting/reading through Usenet, please send an appropriate
your
Post by Chuck McDevitt
message can get through to the mailing list cleanly
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Andrew Dunstan
2007-09-24 17:46:32 UTC
Permalink
Please see if the attached patch works.

cheers

andrew
Post by Chuck McDevitt
Of course it is better not to remove the readonly on all files in the
target dir. That's just a workaround I did because it didn't involve
changing the perl scripts.
I don't know the "right" perl way to change the readonly attribute on a
file. If there isn't one, you could have the perl code issue "attrib"
commands on the target location for each file it is moving. Better if
there is some more "perl" way to do this.
-----Original Message-----
Sent: Monday, September 24, 2007 12:33 AM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Hrrm. I wonder how likely that is, but I can see it's a problem.
That said, it's probably not a bad idea to fix it anyway - it would
correspond to setting the permissions on a unix install, which we do.
For the xcopy commansd, it should be easier to just add a /R switch. But
most files are copied using the internal perl stuff - anybody know if those
can be made to overwrite readonly files easily?
Also, do we really want to remove the readonly file on all the files
in
the
target dir including subdirs? That may hit a bunch of files that
aren't
actualliy "ours". Perhaps we need to process it on a file-by-file basis?
//Magnus
Post by Chuck McDevitt
Well, I was checking out from a different cvs server, and had things
set
Post by Chuck McDevitt
to use CVS EDIT, where everything is read-only by default, until you
issue a cvs edit command.
So many files that aren't built by the build system, but just get
copied
Post by Chuck McDevitt
as-is, end up read-only.
But it would be true for any files set read-only.
-----Original Message-----
Sent: Sunday, September 23, 2007 7:45 PM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem
in
Post by Chuck McDevitt
the
Post by Chuck McDevitt
install.bat/install.pl
If any files that are going to be installed are marked
read-only,
Post by Chuck McDevitt
they
Post by Chuck McDevitt
carry the read-only attribute with them when they get copied to
the
Post by Chuck McDevitt
Post by Chuck McDevitt
install dir.
Then, if you try to run install again, the new attempt will fail
because it can't overwrite the read-only file.
I added this like to install.bat (just before the call to
install.pl)
Post by Chuck McDevitt
attrib /S -r %1\*
Which files are read-only?
cheers
andrew
---------------------------(end of
broadcast)------------------------
---
Post by Chuck McDevitt
TIP 1: if posting/reading through Usenet, please send an appropriate
your
Post by Chuck McDevitt
message can get through to the mailing list cleanly
Andrew Dunstan
2007-09-24 12:59:50 UTC
Permalink
I confess I have never used cvs edit.

Maybe it comes into the realm of "don't do that".

To answer Magnus' question elsewhere, you can't make File::Copy::copy()
do it automatically, nor Win32::CopyFile(). We would need a wrapper
that explicitly unlinked the target before copying. That's certainly
doable, but seems like large surgery for a small problem. I agree that
we don't want to be doing a blank call to attrib as suggested - for one
thing, there might very easily be a datadir inside the target (I do this
habitually, and the buildfarm also puts its datadir right alongside bin,
lib and friends, although it wouldn't be bitten by this), and we surely
don't want to be monkeying with datadir permissions.

cheers

andrew
Post by Chuck McDevitt
Well, I was checking out from a different cvs server, and had things set
to use CVS EDIT, where everything is read-only by default, until you
issue a cvs edit command.
So many files that aren't built by the build system, but just get copied
as-is, end up read-only.
But it would be true for any files set read-only.
-----Original Message-----
Sent: Sunday, September 23, 2007 7:45 PM
To: Chuck McDevitt
Subject: Re: [HACKERS] Problem with MSVC install script
Post by Chuck McDevitt
I was trying out the msvc support, and ran into a minor problem in
the
Post by Chuck McDevitt
install.bat/install.pl
If any files that are going to be installed are marked read-only,
they
Post by Chuck McDevitt
carry the read-only attribute with them when they get copied to the
install dir.
Then, if you try to run install again, the new attempt will fail
because it can't overwrite the read-only file.
I added this like to install.bat (just before the call to
install.pl)
Post by Chuck McDevitt
attrib /S -r %1\*
Which files are read-only?
cheers
andrew
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
Loading...