diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-15 22:09:02 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-15 23:50:41 +0300 |
| commit | 441f64ac277cf87179c97a1e4ec5a95f69dfe25e (patch) | |
| tree | 6d971b1511bcea7fe37202cfbf7e76266e3ad2cd /src/lib | |
| parent | e7aeb1f998aef664d3fc6cc21dc8c3b6b7579d01 (diff) | |
Fix dist root permissions so --sync publishes a readable directory
The dist directory is the swapped-in staging dir, which mktemp -d creates mode
0700. The published album root therefore stayed 0700, so the first `shuriken
--sync` created the remote album directory 0700 and the web server (daemon) could
not read it -- requiring a manual chmod 755 on each mirror.
Relax the staging dir to the umask-default directory mode right after mktemp -d
(what mkdir would have produced), so the dist root matches its subdirectories and
is served/synced with sane permissions. Add a regression test asserting the dist
root mode equals its photos/ subdirectory mode.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.staging.source.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/config.staging.source.sh b/src/lib/config.staging.source.sh index ebb2694..b76da58 100644 --- a/src/lib/config.staging.source.sh +++ b/src/lib/config.staging.source.sh @@ -2,11 +2,21 @@ generation_staging_dir() { local -r final_dist="$1"; shift local final_base local staging_parent + local staging_dir final_base=$(basename "$final_dist") staging_parent=$(existing_parent_dir "$final_dist") - mktemp -d "$staging_parent/.shuriken.$final_base.staging.XXXXXX" + staging_dir=$(mktemp -d "$staging_parent/.shuriken.$final_base.staging.XXXXXX") \ + || return 1 + # mktemp -d forces mode 0700; relax it to the umask-default directory mode + # (what mkdir would have used) so this directory -- which becomes DIST_DIR + # after the swap -- matches its mkdir-created subdirectories and is served and + # synced with sane permissions. Otherwise the published album root stays 0700, + # so the first `shuriken --sync` creates the remote directory 0700 and the web + # server cannot read it. + chmod "$(printf '%o' "$(( 0777 & ~0$(umask) ))")" "$staging_dir" || return 1 + printf '%s\n' "$staging_dir" } prepare_generation_staging_dir() { |
