Build script permissions issue

I've been happily using my bash-based build script for years, and then suddenly with no changes to it, all the sed commands in it started throwing errors as if sed didn't have the proper permissions to create its temp files. For example, the command:
sed -i "1,4d" dynamic-page-loader.tsv
sed -i "1,4d" dynamic-page-loader.tsv
returns this error in the build logs:
sed: preserving permissions for ‘./sedjZDkwD’: Permission denied
sed: preserving permissions for ‘./sedjZDkwD’: Permission denied
Anyone seen anything like this before? Btw, I tried created a temp folder within my build folder to see if that would help, but it didn't.
1 Reply
Hôdl
Hôdl4mo ago
Well, not sure if anyone's seen this, but I have an update all the same. A stackexchange article suggested replacing the sed -i command with a redirect, which seems to have suppressed the errors. No idea why this was necessary, but here's what I did - I replaced lines like this:
sed -i "1,4d" dynamic-page-loader.tsv
sed -i "1,4d" dynamic-page-loader.tsv
with roughly equivalent lines like this:
sed "1,4d" dynamic-page-loader.tsv >dynamic-page-loader.tmp && mv dynamic-page-loader.tmp dynamic-page-loader.tsv
sed "1,4d" dynamic-page-loader.tsv >dynamic-page-loader.tmp && mv dynamic-page-loader.tmp dynamic-page-loader.tsv
Apparently the replacement line is doing exactly what sed -i does automatically, only it isn't throwing the preserving permissions errors. Any idea what's causing this? I'd love to make sure I'm not doing something in violation of Cloudflare policies or about to experience more problems, given how these just started showing up out of the blue.