popen(man XX | col -b)

This is a discussion on popen(man XX | col -b) within the Linux Programming forums, part of the Platform Specific Boards category; I made a simple gtk man page viewer that uses popen("man [page] | col-b", "r") . Most of the time ...

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    popen(man XX | col -b)

    I made a simple gtk man page viewer that uses popen("man [page] | col-b", "r").

    Most of the time it works fine but I've begun to notice that there are a number (maybe one in ten) of pages that return "No manual page for [page]" even tho the other pages in the same path are found, and the exact same command on the command line works fine.

    Perhaps this is not exactly a code problem but I don't know who/where else to ask...

    ps (later): i was so ticked off about this I actually removed my man rpm and build "man-db" (which is also supposedly faster) from source -- but it does the same thing
    Last edited by MK27; 09-26-2008 at 12:42 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Is your cwd getting changed at some point? Or is a path variable being overwritten somehow? I mean there isn't much outside of your code that can cause these sorts of issues. man and man-db are both well documented and well tested.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by master5001 View Post
    Is your cwd getting changed at some point? Or is a path variable being overwritten somehow? I mean there isn't much outside of your code that can cause these sorts of issues. man and man-db are both well documented and well tested.
    Why would the cwd matter? I know env variables are in the stack but they are not being overwritten -- I actually tested the "state of the path" by inserting:

    system("echo $MANPATH");

    before the popen call. All looked well.

    As for man and man-db being well documented & tested, I agree, but I have noticed some clumsy things about man that I sort of assumed were due to redhat (which they may have been, since man-db cleared those up, so it's not been a total loss). And, actually, man-db installs from source without creating a user for man, so when you go to create the database it gives an error. This problem is not diagnosed in their docs but is simple enough to correct if you know enough yourself already. They may have left it that way because it presents some security risk, in the hopes that distro packagers will take care of it. But I think some users could be up a tree, at least for a while.

    So if that level of oversight is acceptable, why would you think everything else is flawless?

    [update] after all that it turned out to be my mistake. But if you want to do some playtesting anyway:
    http://www.intergate.com/~halfcountplus/see
    Last edited by MK27; 09-27-2008 at 02:05 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bitmap conversion from 16x16 to 32x32
    By sharathyd in forum C Programming
    Replies: 6
    Last Post: 01-27-2009, 10:54 PM
  2. Passing a 2d array by Reference
    By loko in forum C Programming
    Replies: 8
    Last Post: 07-23-2005, 06:19 AM
  3. reading pictures and array
    By sunoflight77 in forum C++ Programming
    Replies: 0
    Last Post: 05-09-2005, 03:16 PM
  4. ASCII Art Decoder and Encoder
    By jessweetd in forum C Programming
    Replies: 7
    Last Post: 09-05-2004, 07:12 PM
  5. Is there a bug in this part of my algorithm for connect 4?
    By Nutshell in forum Game Programming
    Replies: 8
    Last Post: 04-28-2002, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21