bugmake - Bugs: bug #58497, inconsistent newline removal in...

 
 

bug #58497: inconsistent newline removal in $(file <)

Submitter:  Ken Tossell <kennyt>
Submitted:  Thu 04 Jun 2020 02:06:36 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.3 Operating System:  Any
Fixed Release:  4.4 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 15 Mar 2021 07:35:13 AM UTC, comment #3: 

Thanks for the patch (Ken) and regression test (Dmitry).

I used Ken's idea of keeping a count: I think that since we need to compare "buffer pointer - 1", not just equality, it's still possible get the wrong behavior using pointer comparison.

I installed Dmitry's regression tests, with a few tweaks to avoid system-specific behaviors (echo -n is not portable) and use a few handy Perl and test suite methods.

Paul D. Smith <psmith>
Group administrator
Mon 08 Jun 2020 02:47:38 AM UTC, comment #2: 

However, i'd like to be able to reproduce realloc returning a smaller address.
Ken, do you have a makefile which reproduces this?

Dmitry Goncharov <dgoncharov>
Mon 08 Jun 2020 02:45:57 AM UTC, comment #1: 

Attached another fix along with new tests.

Dmitry Goncharov <dgoncharov>
Thu 04 Jun 2020 02:06:36 PM UTC, original submission:  

Within $(file <), the output variable's string buffer can get reallocated, potentially being moved to a smaller address than the one it started with.

At the end of this function, the code looks for a final newline to strip, but only if at least one character has been read.

In order to determine whether a character was read, the code tests whether the pointer into the buffer has increased, and this is not the case if the buffer was reallocated to a smaller address.

Ken Tossell <kennyt>

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by dgoncharov (Updated the item)
  • -email is unavailable- added by kennyt (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.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-15 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
        Triage StatusNone Small Effort
    2020-06-08 dgoncharov Attached File- Added sv_58497_fix_function_file.diff, #49224
        Attached File- Added sv_58497_fix_function_file_tests.diff, #49225
    2020-06-04 kennyt Attached File- Added 0001-src-function.c-func_file-fix-inconsistent-newline-re.patch, #49212

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code