bugDatabase-driven manual pager suite - Bugs: bug #58896, MANSECT not properly set for...

 
 

bug #58896: MANSECT not properly set for MANPAGER

Submitter:  Rob Hoelz <hoelzro>
Submitted:  Tue 04 Aug 2020 01:57:44 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  cjwatson
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 04 Feb 2022 03:16:33 PM UTC, comment #3: 

Fixed in man-db 2.10.0.

Colin Watson <cjwatson>
Group administrator
Sun 30 Jan 2022 01:26:06 AM UTC, comment #2: 

Actually, I sneakily amended that to give you credit for the diagnosis, so that's now:

  https://gitlab.com/cjwatson/man-db/-/commit/8966aafcfaba56aa811cb6b5d312d5b33db27d71

Colin Watson <cjwatson>
Group administrator
Sun 30 Jan 2022 01:24:10 AM UTC, comment #1: 

Thanks for your report.  Fixed for the next release:

  https://gitlab.com/cjwatson/man-db/-/commit/97d79bf9712a826b8a3e25b56a07843a44241b93

Colin Watson <cjwatson>
Group administrator
Tue 04 Aug 2020 01:57:44 PM UTC, original submission:  

Hello there!

I believe I have found a bug in man-db - namely, if you set MANSECT when invoking man, only the first section in MANSECT is passed along to MANPAGER.  Here's an example that reproduces the behavior:

<pre>
$ cat > pager
#!/bin/bash

echo "MANSECT: $MANSECT"
$ chmod 755 pager
$ echo $MANSECT
1:l:8:3:0:2:5:4:9:6:7:n
$ MANPAGER=pager man man
MANSECT: 1
</pre>

From a cursory look at the code, I think the problem is in get_section_list; strtok is used on the result of getenv("MANSECT") and alters the environment string in-place, causing the incorrect value to be passed along to future child processes.

I observed this behavior with version 2.9.3 packaged with Arch Linux (which doesn't seem to have any major patches), but I was also able to reproduce it with the current Git HEAD (1c7b46ae as of this writing).

Rob Hoelz <hoelzro>

 

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

Attach Files:
   
   
Comment:
   

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 cjwatson (Posted a comment)
  • -email is unavailable- added by hoelzro (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-04 cjwatson StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-01-30 cjwatson StatusNone Ready For Test
        Assigned toNone cjwatson

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code