bugThe GNU Bourne-Again SHell - Bugs: bug #67536, -Wmisleading-indentation warning...

 
 

bug #67536: -Wmisleading-indentation warning in strtrans.c

Submitter:  correctmost <correctmost>
Submitted:  Fri 19 Sep 2025 04:07:36 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 22 Sep 2025 04:05:33 PM UTC, comment #4: 

On 9/20/25 11:04 PM, Grisha Levit wrote:

> Additional Item Attachment, bug #67536 (group bash):
>
> Name: 0001-ansic_quote-fix-indent-handle-mbrtowc-return-0.patch Size: 1KiB
>
> <https://file.sava ... tch?file_id=57669>


Thanks for the reports and both patches.

Chet

Chet Ramey <chet>
Group administrator
Sun 21 Sep 2025 03:06:15 AM UTC, comment #3: 

Sorry, that was a mistake in my patch.

I'm not sure if it's best to write:


    else
#endif
    if


or


    else
#endif
      if


(The former seems more common in other GNU code).

But either way, the lines following the `if' block were indented incorrectly.

The patch also had a logic error (`break' not breaking out of the loop because it is in a `switch' statement). I'm not sure this is possible to actually trigger but should be fixed anyway.

Both are addressed in the attached file #57669

Grisha Levit <grisha>
Fri 19 Sep 2025 04:45:54 PM UTC, comment #2: 

Thanks!  This is the only -Wmisleading-indentation warning I see when I build with '--enable-readline --with-curses --with-installed-readline --without-bash-malloc'.

It looks like the warning was added in GCC 6:
https://gcc.gnu.o ... cc-6/changes.html

correctmost <correctmost>
Fri 19 Sep 2025 04:31:50 PM UTC, comment #1: 

Is this a new gcc option? There's plenty of this stuff all over the place due to conditional compilation. I'll change this one.

Chet Ramey <chet>
Group administrator
Fri 19 Sep 2025 04:07:36 PM UTC, original submission:  

gcc reports a -Wmisleading-indentation warning in strtrans.c:


strtrans.c: In function ‘ansic_quote’:
strtrans.c:278:11: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
  278 |           else
      |           ^~~~
strtrans.c:286:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
  286 |             *r++ = '\\';
      |             ^


Version info:
- cf8a2518c8b94f75b330d398f5daa0ee21417e1b (devel)
- gcc 15.2.1 on Arch Linux

correctmost <correctmost>

 

Attached Files

Attached Files

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by grisha (Updated the item)
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by correctmost (Submitted the item)
  •  

    Votes

    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.

    Only logged-in users can vote.

     

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

    History

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-09-21 grisha Attached File- Added 0001-ansic_quote-fix-indent-handle-mbrtowc-return-0.patch, #57669
    2025-09-19 chet StatusNone Fixed

    Back to the top

    Powered by Savane 3.16-598c.
    Corresponding source code