tscrape_update: don't preserve permissions of tmp files by moving, so copy - tscrape - twitter scraper
(HTM) git clone git://git.codemadness.org/tscrape
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e22be126773aae620aadb29b9757824dc1060868
(DIR) parent 1b03719564afdb0ba61fa1599d0cb796e10d6ed9
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 23 Feb 2020 20:18:01 +0100
tscrape_update: don't preserve permissions of tmp files by moving, so copy
noticed on DragonFlyBSD where it prints a warning when moving the file from
/tmp.
To reproduce it:
touch /tmp/file
mv /tmp/file ~/
On other systems this would not print a warning, but it would preserve the
group permissions etc.
Diffstat:
M tscrape_update | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/tscrape_update b/tscrape_update
@@ -121,11 +121,12 @@ feed() {
fi
rm -f "${tmpfeedfile}.merge"
- # atomic move.
- if ! mv "${tmpfeedfile}.order" "${tscrapefile}"; then
- log "${name}" "FAIL (MOVE)"
+ # copy
+ if ! cp "${tmpfeedfile}.order" "${tscrapefile}"; then
+ log "${name}" "FAIL (COPY)"
return
fi
+ rm -f "${tmpfeedfile}.order"
# OK
log "${name}" "OK"