bugGNU nano - Bugs: bug #61720, sample nanorc breaks if edited and...

 
 

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

bug #61720: sample nanorc breaks if edited and saved with certain editors

Submitter:  Maxxim <maxxim>
Submitted:  Thu 23 Dec 2021 10:20:31 AM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  None Open/Closed:  Closed

Jump to the original submission

Thu 18 Aug 2022 03:47:00 PM UTC, comment #7: 

comment #6:

> Fixed in git, commit 2a515058, by replacing the control codes and escape sequences with {function} cartouches.


That's a relief. This was REALLY annoying, I actually broke my nanorc again just a couple of days ago while migrating settings to a newer version (which is a regular occurrence on rolling-release distros).

Looking forward to the new release.

Maxxim <maxxim>
Thu 18 Aug 2022 08:57:39 AM UTC, comment #6: 

Fixed in git, commit 2a515058, by replacing the control codes and escape sequences with {function} cartouches.

Benno Schulenberg <bens>
Group administrator
Fri 21 Jan 2022 11:20:46 AM UTC, comment #5: 

When the feature request from bug #61692 gets fulfilled, the problem in this issue can be avoided by rewriting the string binds with function names instead of control codes.

Benno Schulenberg <bens>
Group administrator
Thu 30 Dec 2021 04:51:36 PM UTC, comment #4: 

As another user, I disagree that control sequences should not appear in nanorc. Appropriate handling of control sequences is a feature, not a bug.

If anything, it is the main method by which one can easily create, save (and even share) "string" macros that use such verbatim sequences. (the newly appearing lowercase/uppercase keystrokes are indeed such macros).

As for "less", less has an option (-R) whether to interpret control sequences or not. And cat reproduces the escape sequences appropriately, and can be piped into less or indeed nano without problems.

I tend to agree with the maintainer that if Kate has no proper support for this and ends up garbling the symbols, then that's Kate's problem. I would encourage you to open a bug report there.

Tasos Papastylianou <tpapastylianou>
Thu 23 Dec 2021 04:40:19 PM UTC, comment #3: 

Just to clarify what I mentioned before:

cat:
" mainSh-M-U "|sed 's/.*/\U&/'
" mainSh-M-L "|sed 's/.*/\L&/'

more:
#bind Sh-M-U "|sed 's/.*/\U&/'
#bind Sh-M-L "|sed 's/.*/\L&/'

less:
00000000  23 23 20 53 61 6d 70 6c  65 20 69 6e 69 74 69 61  |## Sample initia|
00000010  6c 69 7a 61 74 69 6f 6e  20 66 69 6c 65 20 66 6f  |lization file fo|
00000020  72 20 47 4e 55 20 6e 61  6e 6f 2e 0a 23 23 0a 23  |r GNU nano..##.#|
<gives hex view of file>

file:
nanorc: data
<not recognized as text file>

I bet there are countless more examples, but I'm sure I made my point by now.

Maxxim <maxxim>
Thu 23 Dec 2021 04:31:33 PM UTC, comment #2: 

Well, control characters are control characters, hence the name. They are not meant to appear within text files except for when they are used to actually serve their assigned function (e.g. tab, newline).

Thinking of this issue as bugs in other applications won't get us very far., e.g. look how 'cat', 'less' and 'file' treat the default nanorc. Would you consider those as bugs, too?

If control characters are required, they should be encoded/escaped.

Maxxim <maxxim>
Thu 23 Dec 2021 04:15:48 PM UTC, comment #1: 

True, it's unusual for a config file to contain control codes (other than Tab and LF).  But in my opinion it's a bug in Kate (and in Gedit and in ne) that it replaces a lone CR with a LF.  That's wrong.  Vim and Emacs and Joe don't do that.  (Nano itself used to do it too, because its heuristic for recognizing a DOS file was wrong.  It was fixed a year and a half ago: https://git.savannah.gnu.org/cgit/nano.git/commit/?id=ac0f2c94.)

Benno Schulenberg <bens>
Group administrator
Thu 23 Dec 2021 10:20:31 AM UTC, original submission:  

After updates, I usually migrate configuration files by comparing and editing them with KDE's Kate. Last time I did this for nano, I ended up with an invalid/broken config.

The issue stems from this section:
## For quickly uppercasing or lowercasing the word under the cursor.
## (These effectively do a Ctrl+Right followed by a Shift+Ctrl+Left,
## and then pipe the selected text through a sed command.)
#bind Sh-M-U "^[Oc^[[1;6D^T|sed 's/.*/\U&/'^M" main
#bind Sh-M-L "^[Oc^[[1;6D^T|sed 's/.*/\L&/'^M" main

The two bind lines contain literal carriage return characters. KDE's Kate interprets this as:
#bind Sh-M-U "Oc|sed 's/.*/\U&/'
" main
#bind Sh-M-L "Oc|sed 's/.*/\L&/'
" main

Thus, when being saved, one ends up with an invalid config. I'm quite sure this is not only an issue with KDE's Kate, but with other editors as well.

In my opinion, the default/sample configuration file should NOT contain ANY literal control characters. This is quite uncommon, I've actually never seen any text-based configuration file with control characters in it before.

Maxxim <maxxim>

 

(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 tpapastylianou (Posted a comment)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by maxxim (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-18 bens StatusWont Fix Fixed
    2022-02-01 bens Open/ClosedOpen Closed
    2022-01-21 bens StatusNone Wont Fix
    2021-12-23 bens Severity3 - Normal 2 - Minor
        SummaryDefault nanorc breaks if edited and saved with different editor sample nanorc breaks if edited and saved with certain editors

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code