emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50070: closed (chmod reads uninitialized variables when fts_info is


From: GNU bug Tracking System
Subject: bug#50070: closed (chmod reads uninitialized variables when fts_info is an error and -v is set, leading to random error messages)
Date: Mon, 16 Aug 2021 04:34:01 +0000

Your message dated Sun, 15 Aug 2021 21:33:26 -0700
with message-id <6eabb0d5-0ce2-a52e-3404-4feff67c3b9a@cs.ucla.edu>
and subject line Re: bug#50070: chmod reads uninitialized variables when 
fts_info is an error and -v is set, leading to random error messages
has caused the debbugs.gnu.org bug report #50070,
regarding chmod reads uninitialized variables when fts_info is an error and -v 
is set, leading to random error messages
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
50070: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50070
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: chmod reads uninitialized variables when fts_info is an error and -v is set, leading to random error messages Date: Sun, 15 Aug 2021 22:15:58 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Thunderbird/93.0a1
Hi,

I noticed that when running chmod with -v on a dangling symlink the error message is somewhat random:

> ln -s file-that-does-not-exist lnk

> chmod -w lnk -v

> chmod: cannot operate on dangling symlink 'lnk'

> failed to change mode of 'lnk' from 0000 (---------) to 7777 (rwsrwsrwt)

> chmod -w lnk -v

> chmod: cannot operate on dangling symlink 'lnk'

> failed to change mode of 'lnk' from 0000 (---------) to 7775 (rwsrwsr-t)

> chmod -w lnk -v

> chmod: cannot operate on dangling symlink 'lnk'

> failed to change mode of 'lnk' from 0000 (---------) to 7774 (rwsrwsr-T)


(note that the value for "to" is different)

This appears to be because in the process_file function, old_mode and new_mode are only set when ok is true. When chmod encounters a dangling symlink, ok will be false and old_mode/new_mode won't be set. However, old_mode and new_mode are still accessed for the invocation of describe_change if verbosity is set to high, leading to incorrect error messages.

I think a better behavior could be to not print the "from mode to mode" part of the error message if the file could not be accessed, since it is meaningless anyways.

Have a nice day,

Michael




--- End Message ---
--- Begin Message --- Subject: Re: bug#50070: chmod reads uninitialized variables when fts_info is an error and -v is set, leading to random error messages Date: Sun, 15 Aug 2021 21:33:26 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0
Thanks for reporting the bug. I installed the attached patch to fix it.

Attachment: 0001-chmod-fix-use-of-uninitialized-var-if-v.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]