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
This is another problem I've noticed, while debugging #4.
On many OpenWRT device /etc/config is a read-only filesystem overlaid with a writable filesystem, while/tmp/ is usually an actual tmpfs/ramdisk.
Consider saveConfig() being called for network.
The call to ioutil.TempFile in saveConfig creates a temporary file in\tmp\.
A subsequent call to os.Rename() tries to hardlink the file to /etc/network.
While this a considered best practice to ensure atomic file changes it will fail for this case as the hardlink crosses filesystem boundaries.
A typical error looks like this: rename /tmp/network012772557 /etc/config/network: invalid cross link
As the user can't choose a different location for the temporary files, this bug renders this library useless on many OpenWRT installations.
The text was updated successfully, but these errors were encountered:
saveConfig now places a temporary file in /etc/config (or whatever the config root is), named /etc/config/.012772557.network, before writing the config to it and renaming it to /etc/config/network. OverlayFS does support hardlinks, doesn't it?
While this may leave dot files behind if (for whatever reason) the cleanup mechanism fails, I'd prefer those files being present over half-written config files if we directly write to /etc/config/network.
As far as I can tell, UCI itself ignores dot files in /etc/config. I didn't find the C source responsible for this behaviour, but I've empirically tested this on one of our OpenWRT devices.
This is another problem I've noticed, while debugging #4.
On many OpenWRT device
/etc/config
is a read-only filesystem overlaid with a writable filesystem, while/tmp/
is usually an actual tmpfs/ramdisk.Consider
saveConfig()
being called fornetwork
.The call to
ioutil.TempFile
insaveConfig
creates a temporary file in\tmp\
.A subsequent call to
os.Rename()
tries to hardlink the file to/etc/network
.While this a considered best practice to ensure atomic file changes it will fail for this case as the hardlink crosses filesystem boundaries.
A typical error looks like this:
rename /tmp/network012772557 /etc/config/network: invalid cross link
As the user can't choose a different location for the temporary files, this bug renders this library useless on many OpenWRT installations.
The text was updated successfully, but these errors were encountered: