Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 4079 - vim backup files readed by update-modules and depscan.sh
Summary: vim backup files readed by update-modules and depscan.sh
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-23 20:26 UTC by Stephane Poinsart
Modified: 2003-02-04 19:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Poinsart 2002-06-23 20:26:17 UTC
when using vim to edit modules and rc scripts, it can create (depending on the
vim configuration) backup files ending with a "~" letter. So when editing files
in /etc/modules.d/ or /etc/init.d/ with vim, it can create new files that
shouldn't be used for the modules or rc dependencies.

for exemple, for files in /etc/modules.d, if you edit /etc/modules.d/i386 and
save it with vim, it create an "/etc/modules.d/i386~". The problem is when
modules-update is run, it write /etc/modules.d/i386 and /etc/modules.d/i386~ in
the /etc/modules.conf, whereas you intended to only write the i386 file, and not
i386~, which can produce errors for futur boots.

suggested fix : 
in /usr/sbin/update-modules, line 88 near the end of the file, add a line like :
    [ -z "${cfg##*~}" ] && continue

diff :

---------------------------------------------
   ...
   for cfg in ${MODDIR}/* $CONF ; do
        [ ! -r "$cfg" ] && continue
+       [ -z "${cfg##*~}" ] && continue
        echo "### update-modules: start processing $cfg" >> $TMPFILE
        if [ -x $cfg ]; then
   ...
---------------------------------------------

the problem is quite the same for rc-update :
it create useless dependencies in /mnt/.init.d/ because backup files are also
concidered.

suggested fix : in /sbin/depscan.sh, for the function check_rcscript(), add  at
line 117 : [ -z "${1##*~}" ] && return 1


diff :
-----------------------------------------
    [ "${1##*.}" = "sh" ] && return 1
    [ "${1##*.}" = "c" ] && return 1
+   [ -z "${1##*~}" ] && return 1

    local IFS='!'
-----------------------------------------

hoppe this will help for all "vim addicted" users (yes, i should use nano, but
nobody is perfect).

for any suggestion : sart@host.sk

    Stephane
Comment 1 Stephane Poinsart 2002-06-23 21:41:35 UTC
so my bug repport invalid ? Could someone please tell me why in just a few words
? Do you think vim backup files should be used exactly like others ? or is it
too specific for a particular vim setup ?

sorry if i made you lose a little time with this repport.
Comment 2 Stephane Poinsart 2002-06-23 22:10:57 UTC
in a few words : if you use vim 6.1 with the exemple rc file :
/usr/share/vim/vim61/vimrc_example.vim to edit /etc/modules.d/i386 for exemple,
your /etc/modules.conf can get corrupted (containing twice the same aliases).
isn't that a bug ?

and a little suggestion : why not using this vimrc as a default ? it's in my
opinion a better choice than the default one (syntax highlighting, automatic
backup...)