From: Lonnie A. <li...@lo...> - 2021-12-13 15:13:01
|
Hi Ramesh, I don't use nano myself ('vi' commands are involuntary to me), though I have replicated your findings. Even if you make a text change in nano and ^X ... -- Save modified buffer? (Answering "No" will DISCARD changes.) N -- nano will *still* write out the original file! I would be open to a patch to nano (2.7.5) to fix this awful behavior. There is a -v (--view) option to nano (View mode (read-only)) which solves the problem. pbx4 ~ # nano -v /etc/shells Possibly create a bash alias "view" pbx4 ~ # alias view='nano -v' would support nano read-only mode pbx4 ~ # view /etc/shells BTW Ramesh, I seem to recall you appreciate "classic" software, the 'ne' editor is much better than nano (IMHO) and 'ne' originated for the Amiga, a Copyright going back to 1992 in the source. 30 years of good stuff, and still maintained. Included by default in AstLinux. ne, the nice editor https://ne.di.unimi.it/ Lonnie > On Dec 13, 2021, at 7:57 AM, Ramesh GK <ram...@ho...> wrote: > > Hi Lonnie, > > Thanks for checking. you are correct. If i open the file in /mnt/asturo/etc/shells then no corresponding file is getting created in /mnt/asturw but if I open the file /etc/shells then a corresponding file is getting created in /mnt/asturw as it is an overlay of /mnt/asturo for /etc. > > i tried to do the same tests that you have done below and figured out the issue. Looks like the issue is occuring because of nano. I use nano for file review or editing mostly. whenever I open the file in nano and close it without making any modifications, it is still trying to save the file i guess. that was the reason a corresponding entry is getting created in /mnt/asturw. > > Thanks > Ramesh GK > From: Lonnie Abelbeck <li...@lo...> > Sent: Sunday, December 12, 2021 6:30 PM > To: AstLinux Developers Mailing List <ast...@li...> > Subject: Re: [Astlinux-devel] Duplicated files in ASTURW > > Hi Ramesh, > > >> When I startup the firmware image and open any file in /mnt/asturo (/etc or /stat) that does not have a link to /tmp, it creates a duplicate file in /mnt/asturw. > > > I'm not sure what "open any file" means ... if you open a file on /mnt/asturo read-only then no file should be written to /mnt/asturw. > > On the other hand, if you open a file on /mnt/asturo and change the contents, timestamp or write to it, then a corresponding change to /mnt/asturw will occur. > > For example: > > pbx4 ~ # ls -l /etc/shells > -rw-r--r-- 1 root root 38 Apr 6 2020 /etc/shells > pbx4 ~ # ls -l /mnt/asturo/etc/shells > -rw-r--r-- 1 root root 38 Apr 6 2020 /mnt/asturo/etc/shells > pbx4 ~ # ls -l /mnt/asturw/etc/shells > ls: /mnt/asturw/etc/shells: No such file or directory > > Then "cat /etc/shells" > > pbx4 ~ # cat /etc/shells > > pbx4 ~ # ls -l /mnt/asturw/etc/shells > ls: /mnt/asturw/etc/shells: No such file or directory > > Note it is not copied to /mnt/asturw > > Also, use an editor and quit without writing ... > > pbx4 ~ # vi /etc/shells > Enter-> :q > > pbx4 ~ # ne /etc/shells > Enter-> <ESC>q or CTL-q > > pbx4 ~ # ls -l /mnt/asturw/etc/shells > ls: /mnt/asturw/etc/shells: No such file or directory > > So in summary, try to understand why the /mnt/asturo files are getting written to when you don't want them to. > > Lonnie > > > > On Dec 12, 2021, at 3:13 PM, Ramesh GK <ram...@ho...> wrote: > > > > Hi, > > > > A while back I reached out of using AstLinux as a Home Gateway Appliance. I am working on the same and observed a weird issue. I migrated the entire build system to buildroot-2017.02.11 and the packages merged between (buildroot and AstLinux) and fixed all (mostly) issues. Happy to share the code base but it is still in beta with a working firmware image as I have not tested the Asterisk components. > > > > When I startup the firmware image and open any file in /mnt/asturo (/etc or /stat) that does not have a link to /tmp, it creates a duplicate file in /mnt/asturw. This should not pose a problem if both files are same however when the firmware image is updated. the file in /mnt/asturo is newer than the file in /mnt/asturw which became stale as it was kept back with the assumption that the file contents have changed but it was in fact the file attributes that got changed. > > > > I could not able to find a cleaner approach and thought of checking if there is any clean way of making sure that the files do not become stale. for now I put in a temporary fix that seem to be working which checks on startup and shutdown if the files between /mnt/asturo and /mnt/asturw are same and if yes then remove the files from /mnt/asturw so they do not become stale. > > > > /etc/init.d/misc > > cleanup_asturw() { > > local dir1=/mnt/asturo > > local dir2=/mnt/asturw > > > > for newfile in $(find $dir2 -type f); do > > if [ -e "${newfile/${dir2}/${dir1}}" ]; then > > file=${newfile/${dir2}/${dir1}} > > if cmp -s "$file" "$newfile" ; then > > # echo "Cleaning up -> $newfile" > > rm -f $newfile > > fi > > fi > > done > > } > > > > mhtgw ~ # stat /etc/common_functions.sh > > File: /etc/common_functions.sh > > Size: 4038 Blocks: 8 IO Block: 1024 regular file > > Device: 12h/18d Inode: 34824 Links: 1 > > Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) > > Access: 2021-12-12 04:51:16.000000000 > > Modify: 2021-12-12 04:51:16.000000000 > > Change: 2021-12-12 20:52:40.000000000 > > > > mhtgw ~ # stat /mnt/asturo/etc/common_functions.sh > > File: /mnt/asturo/etc/common_functions.sh > > Size: 4038 Blocks: 8 IO Block: 4096 regular file > > Device: ch/12d Inode: 3360 Links: 1 > > Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) > > Access: 2021-12-12 04:51:16.000000000 > > Modify: 2021-12-12 04:51:16.000000000 > > Change: 2021-12-12 20:47:12.000000000 > > > > mhtgw ~ # stat /mnt/asturw/etc/common_functions.sh > > File: /mnt/asturw/etc/common_functions.sh > > Size: 4038 Blocks: 8 IO Block: 1024 regular file > > Device: 802h/2050d Inode: 34824 Links: 1 > > Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) > > Access: 2021-12-12 04:51:16.000000000 > > Modify: 2021-12-12 04:51:16.000000000 > > Change: 2021-12-12 20:52:40.000000000 > > > > Any thoughts or ideas are greatly appreciated > > > > Thanks > > Ramesh GK > > > > _______________________________________________ > > Astlinux-devel mailing list > > Ast...@li... > > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fastlinux-devel&data=04%7C01%7C%7C9db4a4d4f17a4f87777a08d9bdc77ac1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637749486727083129%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7Q4hXhcdxsh8KAFWU3ff9vnN1EzLSu2O%2F8VEYQztaWs%3D&reserved=0 > > > > _______________________________________________ > Astlinux-devel mailing list > Ast...@li... > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fastlinux-devel&data=04%7C01%7C%7C9db4a4d4f17a4f87777a08d9bdc77ac1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637749486727083129%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7Q4hXhcdxsh8KAFWU3ff9vnN1EzLSu2O%2F8VEYQztaWs%3D&reserved=0 > _______________________________________________ > Astlinux-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/astlinux-devel |