You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dockerfile pulls ubuntu:20.04 as its base image, which includes 4.7 of sed. This version of sed has filesystem issues breaks thing when it is running in a Docker image. If this version of sed is run on a file that is mounted to the Docker image, it does not work, whether or not sed is run with -i or if you chmod 777 the workdir, and even though the container by default runs as root. Note that this does not happen with all versions of Docker -- this is a Docker Desktop thing, but Docker Desktop is what Docker tends to push these days, so compatibility with it is important.
Ideally, a newer base image should be used, or sed should be manually updated to 4.8 somewhere in the Dockerfile.
This is a known issue with sed and may not need to be replicated, but here's how I found it:
Have a MacOS running Docker Desktop
Build the image locally via docker build --no-cache -t usher install/
Bind the host's workdir, which contains some_file.txt, to /data within the Docker container and enter the container via docker run -v .:/HOME/usher/data -it [whatever-id-the-image-ends-up-with]
cd into /data and attempt to sed -i 's/,/\n/g' some_file.txt or sed 's/,/\n/g' some_file.txt > brand_new_temp_file.txt
Get permissions error
side note (bonus bug?)
There's a rendering error on GitHub with the second sed command. In case it shows up funky, this is what's intended:
Not:
Either way, the point is, this isn't solvable by just not using sed -i.
The text was updated successfully, but these errors were encountered:
The dockerfile pulls ubuntu:20.04 as its base image, which includes 4.7 of
sed
. This version ofsed
has filesystem issues breaks thing when it is running in a Docker image. If this version ofsed
is run on a file that is mounted to the Docker image, it does not work, whether or notsed
is run with-i
or if youchmod 777
the workdir, and even though the container by default runs as root. Note that this does not happen with all versions of Docker -- this is a Docker Desktop thing, but Docker Desktop is what Docker tends to push these days, so compatibility with it is important.Ideally, a newer base image should be used, or sed should be manually updated to 4.8 somewhere in the Dockerfile.
More information
https://discourse.pi-hole.net/t/sed-couldnt-open-temporary-file-etc-pihole-sed/65159/4
To replicate
This is a known issue with sed and may not need to be replicated, but here's how I found it:
docker build --no-cache -t usher install/
/data
within the Docker container and enter the container viadocker run -v .:/HOME/usher/data -it [whatever-id-the-image-ends-up-with]
cd
into/data
and attempt tosed -i 's/,/\n/g' some_file.txt
or sed 's/,/\n/g' some_file.txt > brand_new_temp_file.txtside note (bonus bug?)
There's a rendering error on GitHub with the second sed command. In case it shows up funky, this is what's intended:
![Screenshot 2024-03-06 at 12 10 21 PM](https://private-user-images.githubusercontent.com/27784612/310650319-d93b2a17-8e44-40da-9ac7-89a3a06f3fe7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwNDI3NzcsIm5iZiI6MTcyNjA0MjQ3NywicGF0aCI6Ii8yNzc4NDYxMi8zMTA2NTAzMTktZDkzYjJhMTctOGU0NC00MGRhLTlhYzctODlhM2EwNmYzZmU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTExVDA4MTQzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU2NDBlOTY3MTFlOWY2ODRkOTMxYTU3YWM2MzczYjM4OTNkNjA3NmUzMDliYzJlZGRkZjMwMGVjZDQ0YzcyOTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.HoKzTxCJTZhOna50JjOUUL1nwjV80CJpjmkGDfp1cDE)
Not:
Either way, the point is, this isn't solvable by just not using
sed -i
.The text was updated successfully, but these errors were encountered: