bugGNU nano - Bugs: bug #58685, [Wish] warn when writing to a...

 
 

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

bug #58685: [Wish] warn when writing to a read-only file

Submitter:  Marius Bakke <mbakke>
Submitted:  Tue 30 Jun 2020 09:05:21 PM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Thu 30 Jul 2020 07:17:25 AM UTC, comment #6: 

Released in nano-5.0.

Benno Schulenberg <bens>
Group administrator
Mon 20 Jul 2020 12:44:31 PM UTC, comment #5: 

Oh derp.  Probably I just forgot to use -p1 indeed, I'm too used to 'git am'.


~ $ tar -xf $(guix build --source nano) -C /tmp
~ $ cd /tmp/nano-4.9.3/
/tmp/nano-4.9.3 $ patch -p1 < ~/Downloads/0001-files-warn-the-root-user-when-all-the-write-bits-are.patch
patching file src/files.c
Hunk #1 succeeded at 413 (offset 2 lines).


Thanks!

Marius Bakke <mbakke>
Mon 20 Jul 2020 08:38:12 AM UTC, comment #4: 

Thanks for the feedback (by email).

Fixed in git, commit 180a53cc.

The patch applied fine here to 4.9.3: "Hunk #1 succeeded at 413 (offset 12 lines)."  Maybe you forgot to use -p1 with patch (or -p2, depending on where you are)?  Or maybe you had made local changes?

(Thanks for the info about not being able to post to a closed bug.  I don't understand why some people can and some people cannot.  For example, in bug #57702, the user was able to post comment 7 while the bug was closed.)

Benno Schulenberg <bens>
Group administrator
Fri 17 Jul 2020 11:44:14 AM UTC, comment #3: 

Closing due to lack of response.

Benno Schulenberg <bens>
Group administrator
Wed 08 Jul 2020 01:50:59 PM UTC, comment #2: 

Ping?  Marius?  Would the proposed warning be good enough for you?

Benno Schulenberg <bens>
Group administrator
Wed 01 Jul 2020 04:49:47 PM UTC, comment #1: 

Normal users cannot write to a file when the write-permission bits are lacking.  Only when being root are most of the permission irrelevant.  And the root user should take care what she's doing.  (And if a file really should remain unchanged, root can set the immutable attribute.)

Vim puts "read-only" in the bottom bar when all the write bits are missing, but it does allow editing the buffer, changing the bottom bar to a warning when the user does so, and in the end refuses to write out the file unless root adds "!".  Emacs does not say anything, but simply disallows editing the file, saying "Buffer is read-only" when root tries to do so.

I don't want to add a prompt when writing out a file.  But we can add a warning when opening the file (similar to what we do for a normal user when the file is effectively unwritable).  See the attached patch.  Would that be good enough?

(file #49404)

Benno Schulenberg <bens>
Group administrator
Tue 30 Jun 2020 09:05:21 PM UTC, original submission:  

Currently nano will happily write to a file with permissions 444.

Often such files are read-only for a reason, and it would be nice to prompt the user and ask if they really want to do this.

Marius Bakke <mbakke>

 

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Updated the item)
  • -email is unavailable- added by mbakke (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-30 bens Open/ClosedOpen Closed
    2020-07-20 bens StatusNeed Info Fixed
        Open/ClosedClosed Open
    2020-07-17 bens Open/ClosedOpen Closed
    2020-07-08 bens Assigned toNone bens
    2020-07-01 bens Attached File- Added 0001-files-warn-the-root-user-when-all-the-write-bits-are.patch, #49404
        Severity3 - Normal 1 - Wish
        StatusNone Need Info
        SummaryWarn when writing to a read-only file [Wish] warn when writing to a read-only file

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code