bugGNU nano - Bugs: bug #29312, nano triggers inotify CLOSE_WRITE...

 
 

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

bug #29312: nano triggers inotify CLOSE_WRITE event when opening a file

Submitter:  None
Submitted:  Tue 23 Mar 2010 07:07:04 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Wed 19 Jun 2019 06:25:37 AM UTC, comment #5: 

Released in nano-4.3.

Benno Schulenberg <bens>
Group administrator
Sat 18 May 2019 05:44:55 PM UTC, comment #4: 

Rather late, but... fixed in git now, commit 1b2018e9.

Benno Schulenberg <bens>
Group administrator
Sun 19 Jul 2015 03:56:53 PM UTC, comment #3: 

The closing of the file after reading it is not the problem.  The problem occurs in 'is_file_writable()', which opens the file for writing (just to check whether nano can write to it).

This feature was added in September 2009, shortly before version 2.1.11.  However, vim nor emacs do this.  For reporting that the file is not writable, they rely on just the permission bits.  Chris?  Why was this not enough for nano?

Benno Schulenberg <bens>
Group administrator
Sun 28 Jun 2015 07:21:21 AM UTC, comment #2: 

In a strace, nano first opens the given file, then opens and closes the nano.mo messages files for the current locale, and then closes the given file (and often it opens and closes the given file even a second time) before trying to determine its full path and before starting to edit.

Apparently it will be necessary to keep the file being edited open during the whole time that the associated buffer is open.

Benno Schulenberg <bens>
Group administrator
Sun 28 Jun 2015 07:03:36 AM UTC, comment #1: 

A simpler recipe (and one that avoids being triggered by the lock file being written and closed) is:

touch  TOSSO
inotifywait  -e close_write  TOSSO

Then in another terminal:

nano TOSSO

Benno Schulenberg <bens>
Group administrator
Tue 23 Mar 2010 07:07:04 AM UTC, original submission:  

Firstly, create a temp folder and a test file

$ mkdir ~/temp
$ touch ~/temp/test.txt

Then, start inotifywait on another terminal

$ inotifywait -e close_write ~/temp

Open the test file with nano

$ nano ~/temp/test.txt

As soon as the file is opened, inotifywait will exit with this output:

/home/xxx/temp/ CLOSE_WRITE,CLOSE test.txt

Anonymous

 

(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 (Posted a comment)
  • -email is unavailable- added by sayap
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-19 bens Open/ClosedOpen Closed
    2019-05-18 bens StatusConfirmed Fixed
        Assigned toNone bens
    2015-06-28 bens StatusNone Confirmed
    2010-03-24 sayap Carbon-Copy- Added sayap

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code