user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/5] init: preserve permissions for git prior to 2.1.0
  2019-05-22  2:13  5% [PATCH 0/5] fixes for CentOS 7 Eric Wong
@ 2019-05-22  2:13  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-22  2:13 UTC (permalink / raw)
  To: meta

"git config" did not preserve permissions of the config file it
modifies prior to git 2.1.0, so workaround that.
---
 script/public-inbox-init | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/script/public-inbox-init b/script/public-inbox-init
index 5516e79..2cc704c 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -38,10 +38,11 @@ my $pi_config = PublicInbox::Config->default_file;
 my $dir = dirname($pi_config);
 mkpath($dir); # will croak on fatal errors
 my ($fh, $pi_config_tmp) = tempfile('pi-init-XXXXXXXX', DIR => $dir);
+my $perm;
 if (-e $pi_config) {
 	open(my $oh, '<', $pi_config) or die "unable to read $pi_config: $!\n";
 	my @st = stat($oh);
-	my $perm = $st[2];
+	$perm = $st[2];
 	defined $perm or die "(f)stat failed on $pi_config: $!\n";
 	chmod($perm & 07777, $fh) or
 		die "(f)chmod failed on future $pi_config: $!\n";
@@ -125,6 +126,9 @@ if ($version >= 2) {
 	die "Unsupported -V/--version: $version\n";
 }
 
+# needed for git prior to v2.1.0
+umask(0077) if defined $perm;
+
 foreach my $addr (@address) {
 	next if $seen{lc($addr)};
 	x(@x, "--add", "$pfx.address", $addr);
@@ -136,5 +140,11 @@ if (defined($indexlevel)) {
 	x(@x, "$pfx.indexlevel", $indexlevel);
 }
 
+# needed for git prior to v2.1.0
+if (defined $perm) {
+	chmod($perm & 07777, $pi_config_tmp) or
+			die "(f)chmod failed on future $pi_config: $!\n";
+}
+
 rename $pi_config_tmp, $pi_config or
 	die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n";
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] fixes for CentOS 7
@ 2019-05-22  2:13  5% Eric Wong
  2019-05-22  2:13  7% ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-05-22  2:13 UTC (permalink / raw)
  To: meta

Search::Xapian isn't available from the distro, but we can
support more things with only DBD::SQLite and DBI.

Eric Wong (5):
  init: preserve permissions for git prior to 2.1.0
  t/watch_filter_rubylang: disable v2 test for git < 2.6
  git: workaround old git-rev-parse(1) (--git-path)
  t/search*: require DBI and DBD::SQLite, too
  ci: support CentOS-7

 ci/deps.perl              |  7 +++++++
 ci/profiles.sh            |  6 ++++++
 lib/PublicInbox/Git.pm    |  5 +++++
 script/public-inbox-init  | 12 +++++++++++-
 t/search-thr-index.t      |  7 +++++--
 t/search.t                |  7 +++++--
 t/watch_filter_rubylang.t | 14 ++++++++++++--
 7 files changed, 51 insertions(+), 7 deletions(-)

-- 
EW

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-22  2:13  5% [PATCH 0/5] fixes for CentOS 7 Eric Wong
2019-05-22  2:13  7% ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).