Skip to content

[hostcfgd] avoid in place editing config file contents#3904

Merged
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:hostcfgd
Dec 14, 2019
Merged

[hostcfgd] avoid in place editing config file contents#3904
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:hostcfgd

Conversation

@yxieca
Copy link
Contributor

@yxieca yxieca commented Dec 13, 2019

- What I did

In place editing (sed -i) seems having some issues with filesystem
interaction. It could leave 0 size file or corrupted file behind.

It would be safer to sed the file contents into a new file and switch
new file with the old file.

Signed-off-by: Ying Xie [email protected]

- How to verify it
The issue caused by lacking of this change is repeatable in every so many hundreds of warm reboots into new images. Not a high probability risk. Change had been tested by about 2000 iterations of warm reboots into new images.

In place editing (sed -i) seems having some issues with filesystem
interaction. It could leave 0 size file or corrupted file behind.

It would be safer to sed the file contents into a new file and switch
new file with the old file.

Signed-off-by: Ying Xie <[email protected]>
@yxieca
Copy link
Contributor Author

yxieca commented Dec 14, 2019

retest vs please

@yxieca yxieca merged commit eefa845 into sonic-net:master Dec 14, 2019
@yxieca yxieca deleted the hostcfgd branch December 14, 2019 03:26
yxieca added a commit that referenced this pull request Dec 14, 2019
In place editing (sed -i) seems having some issues with filesystem
interaction. It could leave 0 size file or corrupted file behind.

It would be safer to sed the file contents into a new file and switch
new file with the old file.

Signed-off-by: Ying Xie <[email protected]>
abdosi pushed a commit that referenced this pull request Jan 3, 2020
In place editing (sed -i) seems having some issues with filesystem
interaction. It could leave 0 size file or corrupted file behind.

It would be safer to sed the file contents into a new file and switch
new file with the old file.

Signed-off-by: Ying Xie <[email protected]>
mssonicbld added a commit that referenced this pull request Jun 6, 2025
…atically (#22866)

#### Why I did it
src/sonic-utilities
```
* 3e61eb58 - (HEAD -> 202505, origin/202505) [smartswitch] Fix incorrect reboot status check and improve debug logging in reboot scripts (#3904) (18 hours ago) [mssonicbld]
* 0584975c - [build] Update Azure pipeline to use Ubuntu 24.04 image (#3907) (18 hours ago) [mssonicbld]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants