bugGNU nano - Bugs: bug #60278, an unwritable DOS file gets...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #60278: an unwritable DOS file gets silently changed to Unix format

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 23 Mar 2021 04:08:21 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Wed 24 Mar 2021 11:24:08 AM UTC, comment #2: 

Fixed in git, commit 09b919a6, by always assigning to 'openfile->fmt', also when the file is unwritable.

Benno Schulenberg <bens>
Group administrator
Tue 23 Mar 2021 04:17:09 PM UTC, comment #1: 

Bug exists since version 2.6.0.  Probably since commit 0293eac1.  (I didn't bisect, but this commit prevents openfile->fmt from being set to DOS_FILE or MAC_FILE when the file is unwritable.)

Benno Schulenberg <bens>
Group administrator
Tue 23 Mar 2021 04:08:21 PM UTC, original submission:  

To reproduce, run:

printf "word\r\n" >xxx
src/nano --ignore --nohelp xxx

Type ^O and see that the file would be stored in "DOS Format".

Type ^C ^X, run 'chmod a-w xxx' and open the same file again with the above src/nano command.

Type ^O again and see that now the file would be stored without any format, meaning: Unix format.  This is unexpected.  (Of course, the file is unwritable, but if the user chooses to save the file under a different name, then this new file will not be in DOS format, which is unexpected.  And a diff with the original file would find that all lines have changed, even when no edits were made -- this is unwanted.)

Benno Schulenberg <bens>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-30 bens Open/ClosedOpen Closed
    2021-03-24 bens StatusNone Fixed
    2021-03-23 bens Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code