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

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

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:

                1. 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>
Project 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>

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.7