src/test/ssl/t/001_ssltests.pl should not tromp on file permissions

Started by Tom Lanealmost 9 years ago3 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

I got tripped up while building the 10beta1 tarballs by the fact
that src/test/ssl/ssl/client.key had permissions 0600 in my git
checkout. After a fair amount of head-scratching, I figured out
that this must have been a side-effect of having run the SSL regression
tests at some point in the past. I do not like test scripts that
scribble on non-transient files, not even (or perhaps especially not)
if they're "just" changing the permissions.

We could maybe make 001_ssltests.pl save and restore the file's
permissions, but I think probably a cleaner answer is to have it
make a temporary copy and set the permissions on that.

Thoughts?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#1)
Re: src/test/ssl/t/001_ssltests.pl should not tromp on file permissions

On Tue, May 16, 2017 at 7:05 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

I got tripped up while building the 10beta1 tarballs by the fact
that src/test/ssl/ssl/client.key had permissions 0600 in my git
checkout. After a fair amount of head-scratching, I figured out
that this must have been a side-effect of having run the SSL regression
tests at some point in the past. I do not like test scripts that
scribble on non-transient files, not even (or perhaps especially not)
if they're "just" changing the permissions.

We could maybe make 001_ssltests.pl save and restore the file's
permissions, but I think probably a cleaner answer is to have it
make a temporary copy and set the permissions on that.

Ah, you are talking about ss/client.key here... Using a temporary copy
makes the most sense to me, as there is no need to think about putting
back the old permissions on test failure, and the original tree
remains unmodified all the time.
--
Michael

Attachments:

ssl-test-perms.patchapplication/octet-stream; name=ssl-test-perms.patchDownload+8-7
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#2)
Re: src/test/ssl/t/001_ssltests.pl should not tromp on file permissions

Michael Paquier <michael.paquier@gmail.com> writes:

On Tue, May 16, 2017 at 7:05 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

We could maybe make 001_ssltests.pl save and restore the file's
permissions, but I think probably a cleaner answer is to have it
make a temporary copy and set the permissions on that.

Ah, you are talking about ss/client.key here... Using a temporary copy
makes the most sense to me, as there is no need to think about putting
back the old permissions on test failure, and the original tree
remains unmodified all the time.

Pushed with minor adjustments --- I made the test script unlink the temp
file at the end, and tightened the .gitignore patterns a bit.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers