Skip to content

Commit 344a8d0

Browse files
committed
Preserve file permissions in sedi helper
Use cat+rm instead of mv so the original file's inode and permissions are retained. mktemp creates files with mode 600, and mv would replace the target with those restrictive permissions.
1 parent f0fa36a commit 344a8d0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/bump-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ sedi() {
2222
local expr="$1" file="$2"
2323
local tmp
2424
tmp=$(mktemp)
25-
sed "$expr" "$file" > "$tmp" && mv "$tmp" "$file"
25+
sed "$expr" "$file" > "$tmp" && cat "$tmp" > "$file" && rm "$tmp"
2626
}
2727

2828
echo "Bumping version to: $VERSION"

scripts/sync-api-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ sedi() {
2121
local expr="$1" file="$2"
2222
local tmp
2323
tmp=$(mktemp)
24-
sed "$expr" "$file" > "$tmp" && mv "$tmp" "$file"
24+
sed "$expr" "$file" > "$tmp" && cat "$tmp" > "$file" && rm "$tmp"
2525
}
2626

2727
echo "Syncing API version: $API_VERSION"

0 commit comments

Comments
 (0)