bugGNU nano - Bugs: bug #50897, nano 2.8.1 gives warning if...

 
 

bug #50897: nano 2.8.1 gives warning if compiled without UTF8 for musl libc

Submitted by:  Hannu Nyman <hnyman>
Submitted on:  Sat 29 Apr 2017 12:35:04 PM UTC  
 
Severity: 2 - MinorStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 05 May 2017 09:23:36 AM UTC, comment #4:

The change has been released in 2.8.2. Thanks again for reporting.

(Later I will see if I can pinch a little more off of the tiny version -- there are some lines in move_mbleft that can go.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 30 Apr 2017 10:11:39 AM UTC, comment #3:

> are you sure you want to disable UTF-8?


Note that this is about flash size-constrained home routers. Every byte counts if you need to cram OS and all apps into 4 or 8 MB flash.

Most users never install any locale, as it is not needed for editing config files in Linux console.

So, nano has traditionally been compiled with all the possible "tiny" options (so there is no help included etc.)

It is quite possible that UTF8 will be enabled at some point, but so far it has not been a problem.

Hannu Nyman <hnyman>
Sun 30 Apr 2017 10:02:09 AM UTC, comment #2:

But... are you sure you want to disable UTF-8? Because it means that, when using a locale such as French or Croat, the help texts will be full of illegible stuff. And what's worse: nano will crash when exiting from the help text (see bug #50899). Thanks for helping me find that one. :)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 30 Apr 2017 09:22:06 AM UTC, comment #1:

Thanks for reporting!

Yes, the warning can be seen as cosmetics -- no harm will happen.

In fact, all I wanted to know is whether there are systems that have an MB_CUR_MAX bigger than 6 when using UTF-8. I didn't think that anyone would compile with --disable-utf8. So now, for that case, the warning does not get included.

Fixed in git, a8a60b29.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 29 Apr 2017 12:35:04 PM UTC, original submission:

Nano 2.8.1 gives warning "Unexpected large character size" if it has been compiled for musl-libc with UTF8 disabled in nano configuration.

root@router2:~# nano
Unexpected large character size: 4 bytes -- please report a bug

Can that warning be seen as cosmetics and be patched away?
Or is it an actual warning that something might go wrong internally in nano?

Compiling nano with UTF8 support makes the warning go away but increases its size by some 4%.

Musl is a popular small libc for embedded devices and the relevant changes in it (see below) have been already in 2015. Nano 2.7.5 has worked quite ok with the same configure options. The warning has surfaced with the move to 2.8.1.

My interpretation:

nano 2.8.1 has a new warning about possible inconsistency (no UTF8 support active in nano while according to locale the max. char length is more than 1). Musl libc sets MB_CUR_MAX to 4 unless the locale is explicitly set to C, when the value is 1. And that seems to trigger the new warning in nano as 4>1.

Context:
Openwrt/LEDE, routers & embedded devices, Linux kernel 4.4 and 4.9, musl-libc C library

Configure options in used in nano compilation:
CONFIGURE_ARGS += --enable-tiny --disable-utf8 -without-slang --disable-color
CONFIGURE_VARS += ac_cv_header_regex_h=no

$ ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --enable-tiny --disable-utf8 --without-slang --disable-color

Relevant pull request in Openwrt/LEDE packages repo:
https://github.com/openwrt/packages/pull/4286

Relevant commits causing the warning to get triggered:

http://git.savannah.gnu.org/cgit/nano.git/commit/?id=aedc3ddd49b50fcee73ad76e193ab0a2c68f4adf
http://git.musl-libc.org/cgit/musl/commit/?id=1507ebf837334e9e07cfab1ca1c2e88449069a80
http://git.musl-libc.org/cgit/musl/commit/?id=f22a9edaf8a6f2ca1d314d18b3785558279a5c03

Hannu Nyman <hnyman>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by hnyman (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 05 May 2017 09:23:36 AM UTCbensOpen/ClosedOpen=>Closed
    Sun 30 Apr 2017 09:22:06 AM UTCbensSeverity3 - Normal=>2 - Minor
      StatusNone=>Fixed
      Assigned toNone=>bens

    Back to the top


    Powered by Savane 3.1-cleanup1