Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2009-07-22 Thread Colin Watson
clone 363250 -1
reassign -1 general
retitle -1 PAGER as a pipeline
tags 363250 fixed-upstream
thanks

On Sun, Apr 23, 2006 at 09:52:34PM +0200, Loïc Minier wrote:
>  Yes, indeed, the root of the problem is the change of support for
>  pipelines.  However, I'm not sure that pipelines worked in the use case
>  of passing a file as a parameter to $PAGER in the past.
> 
>  Currently, each program (for example man) has its way of calling
>  $PAGER, perhaps as "$PAGER " or piping to "sh -c "$PAGER"",
>  or perhaps piping directly to "$PAGER".
> 
>  Of course, if we say $PAGER can be a pipeline, and a pager can be used
>  both as "$PAGER " and as the end of a pipeline, then
>  defining $PAGER to be a pipeline must work in both cases, but I'm not
>  sure it is a regression to not support pipelines in the use case of a
>  file name as argument.
> 
>  In other words:
> 
> $PAGER is a $PAGER is a
> program pipeline
>  
>  call $PAGER as works   ???
>  $PAGER 
>  
>  call $PAGER as
>  cat  | $PAGERworks   works

That last entry is not correct. See below.

>  I do agree that the two use cases that you listed in a previous message
>  exist, I'm not sure they were both supported in the case where $PAGER
>  is a pipeline, but we can work on fixing that at least in
>  sensible-pager by using systematically: cat "$@" | $PAGER

Sorry I took so long to deal with this bug report against man-db. I must
confess that the length of the thread intimidated me a bit!

For the meantime, I note that putting pipes in $PAGER doesn't work even
with sensible-pager, since variable expansion doesn't work that way in
shell:

  $ cat f
  foo
  bar
  $ PAGER='cat | grep bar' sensible-pager f
  cat: |: No such file or directory
  cat: grep: No such file or directory
  cat: bar: No such file or directory
  foo
  bar
  $ PAGER='cat | grep bar' http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_01

I therefore don't think it makes sense to do the not inconsiderable
amount of work required to support pipes-in-$PAGER in man-db when even
sensible-pager can't cope wth it. (The reason it used to work was that
man-db used to be very sloppy about all sorts of things and just passed
stuff to system(); over the last few years I taught it how to handle
pipelined command execution itself, which fixed a wide variety of
interesting bugs. As a result, though, pipes in $PAGER and other things
that man-db interprets stopped being supported.)

For the meantime, I've simply documented the constraints on PAGER and
friends in man(1), and advised the use of a script in such cases:

Tue Jul 21 15:17:49 BST 2009  Colin Watson  

* man/man1/man.man1 (Controlling formatted output, ENVIRONMENT):
  Explicitly state that -P/$PAGER/$MANPAGER identifies a single
  command with no pipes (Debian bug #363250).

If we want to extend PAGER in general, then I'm willing to revisit this.

Cheers,

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-23 Thread Manoj Srivastava
On 23 Apr 2006, Loïc Minier verbalised:

> On Sun, Apr 23, 2006, Manoj Srivastava wrote:
>> Since allowing pipelines seems to be the motivating factor
>> here, we do need to solve that, I think.
>
> Yes, indeed, the root of the problem is the change of support for
> pipelines.  However, I'm not sure that pipelines worked in the use
> case of passing a file as a parameter to $PAGER in the past.
>
> Currently, each program (for example man) has its way of calling
> $PAGER, perhaps as "$PAGER " or piping to "sh -c
> "$PAGER"", or perhaps piping directly to "$PAGER".
>
> Of course, if we say $PAGER can be a pipeline, and a pager can be
> used both as "$PAGER " and as the end of a pipeline, then
> defining $PAGER to be a pipeline must work in both cases, but I'm
> not sure it is a regression to not support pipelines in the use case
> of a file name as argument.
>
> In other words:
>
> $PAGER is a $PAGER is a
> program pipeline
> 
> call $PAGER as works   ???
> $PAGER 
> 
> call $PAGER as
> cat  | $PAGERworks   works
>
> I do agree that the two use cases that you listed in a previous
> message exist, I'm not sure they were both supported in the case
> where $PAGER is a pipeline, but we can work on fixing that at least
> in sensible-pager by using systematically: cat "$@" | $PAGER

Historically, if my memory serves me correctly, one used PAGER
 to specify the program, and the default arguments. PAGER essentially
 worked as an shell alias:
PAGER= less -cim
 And then you could either pipe thigs to ti, or call it on a file.  I
 am not sure if I recall a-pipeline-as-pager ever working, even way
 back in the mid 80's.

manoj
-- 
It is sweet to let the mind unbend on occasion. Quintus Horatius
Flaccus (Horace)
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-23 Thread Loïc Minier
On Sun, Apr 23, 2006, Manoj Srivastava wrote:
> Since allowing pipelines seems to be the motivating factor
>  here, we do need to solve that, I think.

 Yes, indeed, the root of the problem is the change of support for
 pipelines.  However, I'm not sure that pipelines worked in the use case
 of passing a file as a parameter to $PAGER in the past.

 Currently, each program (for example man) has its way of calling
 $PAGER, perhaps as "$PAGER " or piping to "sh -c "$PAGER"",
 or perhaps piping directly to "$PAGER".

 Of course, if we say $PAGER can be a pipeline, and a pager can be used
 both as "$PAGER " and as the end of a pipeline, then
 defining $PAGER to be a pipeline must work in both cases, but I'm not
 sure it is a regression to not support pipelines in the use case of a
 file name as argument.

 In other words:

$PAGER is a $PAGER is a
program pipeline
 
 call $PAGER as works   ???
 $PAGER 
 
 call $PAGER as
 cat  | $PAGERworks   works

 I do agree that the two use cases that you listed in a previous message
 exist, I'm not sure they were both supported in the case where $PAGER
 is a pipeline, but we can work on fixing that at least in
 sensible-pager by using systematically: cat "$@" | $PAGER

   Bye,

-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-22 Thread Manoj Srivastava
On 22 Apr 2006, Loïc Minier outgrape:

> On Sat, Apr 22, 2006, Manoj Srivastava wrote:
>> There are two use cases that any pager directive must address:
>> 1) The program is going to generate output which must be piped to
>> a pager
>> 2) The program want to send a file to the user.

> I agree that these use cases need to be supported.

>> But perhaps the policy for Debian should be for programs to ignore
>> PAGER and just use sensible pager, where all the logic for dealing
>> with pager goes in. I still don't see how sensible pager can handle
>> the pipeline vs the non-pipeline case, though.

> Yes, I believe the policy should be changed in this way, and as I
> proposed.

Hmm.  This could be a potentially disruptive change -- since a
 lot of programs may need to be changed in non-trivial ways.

> Look at the code of sensible-pager, it will call "$PAGER" if
> sensible-pager is called without any argument, and "$PAGER
> " if it's called as "sensible-pager ".  This
> seems good enough for me; if people set $PAGER to a pipeline, they
> might suffer from problems for the second case, but we can work on
> that.

Err, so we can't make this policy (allowing $PAGER to be a
 pipeline) until we have a solution for this, given that we have
 agreed that the two use cases for $PAGER must be  feasible.


>> Barring that, policy would have to be that programs can' t user
>> PAGER to work with use case 2, and must be guilty of an "useless
>> use of cat" to pipe data to STDIN for PAGER.

> Yes, if you mean that permitting pipelines forbids programs to call
> "$PAGER $file", I agree with you.  There are multiple ways to solve
> this, but I think that whatever way is chosen should be implemented
> in sensible-pager, and we can even change our mind later, and fix
> only sensible-pager.  The contract of sensible-pager with respect to
> Debian programs should be to offer two modes of operation, the pipe
> of data on stdin mode, and the pass a file on the command line mode
> (matching your use cases 1 and 2).

>> PAGER has the benefit of being long standardized, and if we do
>> not use PAGER, we are breaking user expectations.
>> What is the benefit of creating a PAGER clone?

> sensible-pager is not a PAGER clone, it permits us to enhance the
> handling of $PAGER in a single place instead of changing every
> program in Debian that wants to send something to $PAGER.

The point is that lots of programs already respect $PAGER,
 with varying semantics (most support $PAGER being less or more or
 something, but not all support arbitary pipelines.


>>> B/ user configuration of the pager When defined, $PAGER is a sh
>>> pipeline which reads its data from stdin.
>> How do programs present a text file to the user using a PAGER,
>> then? cat file.txt | $PAGER?

> That's a question for sensible-pager to solve, but one way is to use
> cat "$@" | $PAGER indeed.

Umm. If we are talking about making policy, we can't just make
 policy and say things are a problem for some package or the other to
 solve.

>> In other words, ignore $PAGER, use sensible-pager all over,
>> and let that handle it?
>
> Yes.
>
>> Not, unless these questions are answered, and we actually have
>> a working implementation.
>
> Well the current implementation works, except for pipelines.  :)

Since allowing pipelines seems to be the motivating factor
 here, we do need to solve that, I think.

manoj
-- 
I am here by the will of the people and I won't leave until I get my
raincoat back.- a slogan of the anarchists in Richard Kadrey's
"Metrophage"
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-22 Thread Loïc Minier
Hi,

On Sat, Apr 22, 2006, Manoj Srivastava wrote:
> > Please read again the original report, the submitter wanted to have
> > a pipe of commands in $PAGER, he said this worked in the past, and
> > works on other distros.  He did not want to simply be able to use
> > $PAGER on a file or to pipe stuff to $PAGER, he wanted $PAGER to be
> > parsed as a pipeline, as in sh syntax.
> I read it. I still think that my answer suffices: Put your
>  pipeline in a script, and set that to PAGER.  If I have a file that I
>  want the users to see, as opposed to output I create, how can I
>  figure out how to use the example in the initial bug report?

 The point is that it used to work with a pipeline, as explained by the
 submitter, in the past and now it doesn't work, I later replied that it
 was never said that the content of $PAGER was following sh syntax.

 You propose a (valid) workaround, I propose to fix the policy, and to
 even actually support sh syntax (as this is trivial to do from
 sensible-pager).

> There are two use cases that any pager directive must address:
> 1) The program is going to generate output which must be piped to
>a pager
> 2) The program want to send a file to the user.

 I agree that these use cases need to be supported.

> If the PAGER semantics are defined to state that whatever you
>  change it to must work in the two use cases, then programs that use
>  PAGER directly would not have an issue.

 But, if I follow you, this would prevent pipelines.

> But perhaps the policy for Debian should be for programs to
>  ignore PAGER and just use sensible pager, where all the logic for
>  dealing with pager goes in. I still don't see how sensible pager can
>  handle the pipeline vs the non-pipeline case, though.

 Yes, I believe the policy should be changed in this way, and as I
 proposed.

 Look at the code of sensible-pager, it will call "$PAGER" if
 sensible-pager is called without any argument, and "$PAGER "
 if it's called as "sensible-pager ".  This seems good enough
 for me; if people set $PAGER to a pipeline, they might suffer from
 problems for the second case, but we can work on that.

> Barring that, policy would have to be that programs can' t
>  user PAGER to work with use case 2, and must be guilty of an "useless
>  use of cat" to pipe data to STDIN for PAGER.

 Yes, if you mean that permitting pipelines forbids programs to call
 "$PAGER $file", I agree with you.  There are multiple ways to solve
 this, but I think that whatever way is chosen should be implemented in
 sensible-pager, and we can even change our mind later, and fix only
 sensible-pager.  The contract of sensible-pager with respect to Debian
 programs should be to offer two modes of operation, the pipe of data on
 stdin mode, and the pass a file on the command line mode (matching your
 use cases 1 and 2).

> PAGER has the benefit of being long standardized, and if we do
>  not use PAGER, we are breaking user expectations.
> What is the benefit of creating a PAGER clone?

 sensible-pager is not a PAGER clone, it permits us to enhance the
 handling of $PAGER in a single place instead of changing every program
 in Debian that wants to send something to $PAGER.

 Have a look at the sensible-browser code, and at #351901 to convince
 you that there are useful things that can be done in such a nice place
 as sensible-pager.  Eg, we might send data to "yelp" if running under
 GNOME.

> > B/ user configuration of the pager When defined, $PAGER is a sh
> > pipeline which reads its data from stdin.
> How do programs present a text file to the user using a PAGER,
>  then? cat file.txt | $PAGER?

 That's a question for sensible-pager to solve, but one way is to use
 cat "$@" | $PAGER indeed.

> > This is with the intent of moving any logic for deciding of the best
> > pager to run out of each individual program requiring a pager,
> > exactly as in the sensible-browser case, which can consider
> > $BROWSER, $DISPLAY, x-www-browser, and www-browser to find a
> > sensible browser.
> In other words, ignore $PAGER, use sensible-pager all over,
>  and let that handle it?

 Yes.

> Not, unless these questions are answered, and we actually have
>  a working implementation.

 Well the current implementation works, except for pipelines.  :)

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-22 Thread Manoj Srivastava
On 22 Apr 2006, Loïc Minier spake thusly:

> On Sat, Apr 22, 2006, Manoj Srivastava wrote:
 363250 is more about documenting the semantics of $PAGER (whether
>>> it can uses sh syntax, or whether it's a command with parameters
>>> separated with spaces), to be documented in man man, and/or
>>> policy.
>> Err, we should define how it behaves, not what is inside it. As
>> long as one can pipe things to $PAGER or use $PAGER on a file, what
>> it contains should not matter.
>
> Please read again the original report, the submitter wanted to have
> a pipe of commands in $PAGER, he said this worked in the past, and
> works on other distros.  He did not want to simply be able to use
> $PAGER on a file or to pipe stuff to $PAGER, he wanted $PAGER to be
> parsed as a pipeline, as in sh syntax.

I read it. I still think that my answer suffices: Put your
 pipeline in a script, and set that to PAGER.  If I have a file that I
 want the users to see, as opposed to output I create, how can I
 figure out how to use the example in the initial bug report?


There are two use cases that any pager directive must address:

1) The program is going to generate output which must be piped to
   a pager
2) The program want to send a file to the user.


>> The safe bet would be for $PAGER to be a script or executable
>> which can handle reading from file or STDIN, like proper UNIX
>> programs.
>
> This is an independent problem First, we already have one layer of
> sh scripting with the sensible-pager program, and it would be a good
> enough place to handle the cases you mention, would people and
> programs use sensible-pager as the default pager.  Second, this
> doesn't define what should happen when someone redefines $PAGER:
> what if one user wants $PAGER to be a pipeline?

If the PAGER semantics are defined to state that whatever you
 change it to must work in the two use cases, then programs that use
 PAGER directly would not have an issue.

But perhaps the policy for Debian should be for programs to
 ignore PAGER and just use sensible pager, where all the logic for
 dealing with pager goes in. I still don't see how sensible pager can
 handle the pipeline vs the non-pipeline case, though.

Barring that, policy would have to be that programs can' t
 user PAGER to work with use case 2, and must be guilty of an "useless
 use of cat" to pipe data to STDIN for PAGER.

Neither one of these is a happy prospect.

>> To make life easier for people writing programs which deal
>> with $PAGER, and  are using the POSIX exce* set of calls, one may
>> constrain $PAGER to "path [arg [arg ..]]", with no pipes or other
>> shell meta-characters.
>
> Yes, I think this is safe, but I'd go even further and propose the
> following:
> A/ handling of pager in programs
> 1/ programs should default to sensible-pager
> 2/ programs should offer a way to override the default pager in some
> way, for example via an environment variable called _PAGER,
> or a configuration setting -- it might even be better for them to
> avoid handling $PAGER, see 1/

PAGER has the benefit of being long standardized, and if we do
 not use PAGER, we are breaking user expectations.

What is the benefit of creating a PAGER clone?

> B/ user configuration of the pager When defined, $PAGER is a sh
> pipeline which reads its data from stdin.

How do programs present a text file to the user using a PAGER,
 then? cat file.txt | $PAGER?

> This is with the intent of moving any logic for deciding of the best
> pager to run out of each individual program requiring a pager,
> exactly as in the sensible-browser case, which can consider
> $BROWSER, $DISPLAY, x-www-browser, and www-browser to find a
> sensible browser.

In other words, ignore $PAGER, use sensible-pager all over,
 and let that handle it?

> Manoj, how would this fit in policy?

Not, unless these questions are answered, and we actually have
 a working implementation.

manoj
-- 
Liberty don't work as good in practice as it does in speeches. The
Best of Will Rogers
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-22 Thread Loïc Minier
On Sat, Apr 22, 2006, Manoj Srivastava wrote:
> > #363250 is more about documenting the semantics of $PAGER (whether
> > it can uses sh syntax, or whether it's a command with parameters
> > separated with spaces), to be documented in man man, and/or policy.
> Err, we should define how it behaves, not what is inside
>  it. As long as one can pipe things to $PAGER or use $PAGER on a file,
>  what it contains should not matter.

 Please read again the original report, the submitter wanted to have a
 pipe of commands in $PAGER, he said this worked in the past, and works
 on other distros.  He did not want to simply be able to use $PAGER on a
 file or to pipe stuff to $PAGER, he wanted $PAGER to be parsed as a
 pipeline, as in sh syntax.

> The safe bet would be for $PAGER to be a script or executable
>  which can handle reading from file or STDIN, like proper UNIX
>  programs.

 This is an independent problem  First, we already have one layer of sh
 scripting with the sensible-pager program, and it would be a good
 enough place to handle the cases you mention, would people and programs
 use sensible-pager as the default pager.  Second, this doesn't define
 what should happen when someone redefines $PAGER: what if one user
 wants $PAGER to be a pipeline?

> To make life easier for people writing programs which deal
>  with $PAGER, and  are using the POSIX exce* set of calls, one may
>  constrain $PAGER to "path [arg [arg ..]]", with no pipes or other
>  shell meta-characters.

 Yes, I think this is safe, but I'd go even further and propose the
 following:
 A/ handling of pager in programs
 1/ programs should default to sensible-pager
 2/ programs should offer a way to override the default pager in some
way, for example via an environment variable called _PAGER,
or a configuration setting -- it might even be better for them to
avoid handling $PAGER, see 1/

 B/ user configuration of the pager
 When defined, $PAGER is a sh pipeline which reads its data from stdin.


 This is with the intent of moving any logic for deciding of the best
 pager to run out of each individual program requiring a pager, exactly
 as in the sensible-browser case, which can consider $BROWSER, $DISPLAY,
 x-www-browser, and www-browser to find a sensible browser.

 Manoj, how would this fit in policy?

-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-22 Thread Manoj Srivastava
On 21 Apr 2006, Loïc Minier spake thusly:

> Hi,
>
> On Fri, Apr 21, 2006, Manoj Srivastava wrote:
>> Here is my solution for using vim + script as a pager; similar
>> mechanisms can be used to use plain vim as PAGER as well.
>
> Nice, I suggest filing a new bug against vim to propose this as a
> contrib script, or to ship it as "vim-pager" wrapper.
>
> #363250 is more about documenting the semantics of $PAGER (whether
> it can uses sh syntax, or whether it's a command with parameters
> separated with spaces), to be documented in man man, and/or policy.


Err, we should define how it behaves, not what is inside
 it. As long as one can pipe things to $PAGER or use $PAGER on a file,
 what it contains should not matter.

The safe bet would be for $PAGER to be a script or executable
 which can handle reading from file or STDIN, like proper UNIX
 programs.

To make life easier for people writing programs which deal
 with $PAGER, and  are using the POSIX exce* set of calls, one may
 constrain $PAGER to "path [arg [arg ..]]", with no pipes or other
 shell meta-characters.

manoj
-- 
"'Tis not too late to seek a newer world." Alfred, Lord Tennyson
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-21 Thread Loïc Minier
Hi,

On Fri, Apr 21, 2006, Manoj Srivastava wrote:
> Here is my solution for using vim + script as a pager; similar
>  mechanisms can be used to use plain vim as PAGER as well.

 Nice, I suggest filing a new bug against vim to propose this as a
 contrib script, or to ship it as "vim-pager" wrapper.

 #363250 is more about documenting the semantics of $PAGER (whether it
 can uses sh syntax, or whether it's a command with parameters separated
 with spaces), to be documented in man man, and/or policy.

 There's also another bug discussed in #363250 which is about nview's
 view not working correctly, but I didn't look into that.

   Bye,

-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-21 Thread Manoj Srivastava
Hi,

Here is my solution for using vim + script as a pager; similar
 mechanisms can be used to use plain vim as PAGER as well.

,
| #!/bin/bash
| # Shell script to start Vim with less.vim.
| # Read stdin if no arguments were given.
| 
| #VRUNTIME=/usr/share/vim/vim64/
| VRUNTIME=$HOME/etc/vim/
| if test $# = 0; then
|   vim -c "so $VRUNTIME/macros/less.vim" -
| else
|   vim -c "so $VRUNTIME/macros/less.vim" "$@"
| fi
`

I take no credit for the vim script or the idea, but it seems
 to work pretty well. Note how the vim invocation changes based on
 whether the PAGER is being used as a filter or not.

manoj
-- 
"When in doubt, use brute force." Ken Thompson
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-20 Thread Manoj Srivastava
On 20 Apr 2006, Steve Langasek spake thusly:

> On Thu, Apr 20, 2006 at 12:05:16AM -0500, Manoj Srivastava wrote:
 I expect to be able to pipe stuff to $PAGER, or invoke $PAGER
 on a text file, like so:
>
 % cat~/.bash_profile | $PAGER
 % $PAGER ~/.bash_profile
>
>>> That seems to be an awfully user-specific expectation, given that
>>> you can't assume that PAGER is set *at all* by default.
>
>> Err, if the PAGER is empty, default it to "more".  What does
>> that have to do with the price of tea in china?
>
> $ echo $PAGER
>
> $ $PAGER tea\ in\ china
> bash: ./tea in china: Permission denied
> $
>
> If $PAGER isn't set, then you can't very well use it as you
> describe, can you?
>
> 'Course, you can use the sensible-pager command this way.  And
> sensible-pager does expect that $PAGER, if set, can take file names
> as appended arguments.  So I guess your use cases do model the
> defacto policy for use of $PAGER.

The discussion here is about what the expectation are for the
 contents of #PAGER, if it  exists, not how to correctly use
 $PAGER. You are throwing red herrings and derailing the discussion,
 please stop it. Specifically, the issue started as how to use vim as
 PAGER, and lead to what the semantics of the PAGER were.  What to do
 when PAGER does not exist are orthogonal.

My statements attempt to provide an expectation of the use
 cases a PAGER variable setting ought to be able to implement.  It is
 relevant to deciding how to set $PAGER, your mail adds nothing to the
 topic. 

If you truly want to discuss how to actually use $PAGER
 correctly, start your own topic, and don't hijack this thread.

manoj

-- 
I like your SNOOPY POSTER!!
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-20 Thread Steve Langasek
On Thu, Apr 20, 2006 at 12:05:16AM -0500, Manoj Srivastava wrote:
> >> I expect to be able to pipe stuff to $PAGER, or invoke $PAGER
> >> on a text file, like so:

> >> % cat~/.bash_profile | $PAGER
> >> % $PAGER ~/.bash_profile

> > That seems to be an awfully user-specific expectation, given that
> > you can't assume that PAGER is set *at all* by default.

> Err, if the PAGER is empty, default it to "more".  What does
>  that have to do with the price of tea in china?

$ echo $PAGER

$ $PAGER tea\ in\ china
bash: ./tea in china: Permission denied
$

If $PAGER isn't set, then you can't very well use it as you describe, can
you?

'Course, you can use the sensible-pager command this way.  And
sensible-pager does expect that $PAGER, if set, can take file names as
appended arguments.  So I guess your use cases do model the defacto policy
for use of $PAGER.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/


signature.asc
Description: Digital signature


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-19 Thread Manoj Srivastava
On 19 Apr 2006, Steve Langasek uttered the following:

> On Wed, Apr 19, 2006 at 09:12:04AM -0500, Manoj Srivastava wrote:
>>> which explicitely calls sh -c to handle pipes and quotes in the
>>> expected way.
>
>> I expect to be able to pipe stuff to $PAGER, or invoke $PAGER
>> on a text file, like so:
>
>> % cat~/.bash_profile | $PAGER
>> % $PAGER ~/.bash_profile
>
> That seems to be an awfully user-specific expectation, given that
> you can't assume that PAGER is set *at all* by default.

Err, if the PAGER is empty, default it to "more".  What does
 that have to do with the price of tea in china?

If I, as a user, set PAGER such that it meets the above
 expectations, I expect other programs to work with my setting. I do
 not expect other programs on my system to have more stringent
 requirements than the ones given above.

Having PAGER set to a value that can have stuff piped to it,
 to can be invoked on files, seems a reasonable requirement.

manoj
-- 
Long life is in store for you.
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-19 Thread Steve Langasek
On Wed, Apr 19, 2006 at 09:12:04AM -0500, Manoj Srivastava wrote:
> > which explicitely calls sh -c to handle pipes and quotes in the
> > expected way.

> I expect to be able to pipe stuff to $PAGER, or invoke $PAGER
>  on a text file, like so:

>  % cat~/.bash_profile | $PAGER
>  % $PAGER ~/.bash_profile

That seems to be an awfully user-specific expectation, given that you can't
assume that PAGER is set *at all* by default.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/


signature.asc
Description: Digital signature


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-19 Thread Manoj Srivastava
On 18 Apr 2006, Loïc Minier uttered the following:

> reassign 363250 man retitle 363250 Please clarify how $PAGER is
> invoked in the man manpage stop
>
> Hi,
>
> On Tue, Apr 18, 2006, Rohan Dhruva wrote:
>> export PAGER="col -b | view -c 'set ft=man nomod nolist
>> titlestring=MANPAGE' -"
>
> This $PAGER definition makes the assumption that it's passed to sh
> -c (you use pipes and quotes).  The man manpage doesn't say that
> $PAGER is passed to sh -c, it says it will use $PAGER as the program
> to display the manual page.
>
> I suggest you use: export PAGER="sh -c \"col -b | view -c 'set
> ft=man nomod nolist titlestring=MANPAGE' -\""
>
> which explicitely calls sh -c to handle pipes and quotes in the
> expected way.

I expect to be able to pipe stuff to $PAGER, or invoke $PAGER
 on a text file, like so:

 % cat~/.bash_profile | $PAGER
 % $PAGER ~/.bash_profile

manoj
-- 
Be regular and orderly in your life, so that you may be violent and
original in your work.  -- Flaubert
Manoj Srivastava   <[EMAIL PROTECTED]>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Adeodato Simó
* Rohan Dhruva [Tue, 18 Apr 2006 22:30:29 +0530]:

> view: -s option is only applicable to ex.

  % /usr/sbin/update-alternatives --display view | grep current

-- 
Adeodato Simó dato at net.com.org.es
Debian Developer  adeodato at debian.org
 
— Quieto parao. Usted no está en condiciones de ir a ningún sitio.
  Dígame dónde está la muchacha y yo iré a por ella.
— No sé dónde está.
— Le voy a pedir que sea algo más específico.
-- Carlos Ruiz Zafón, “La sombra del viento”



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Loïc Minier
Hi,

On Wed, Apr 19, 2006, Rohan Dhruva wrote:
> That was exactly what I wanted in the first place, so I did have vim
> installed. The problem is that, alternatives had symlinked view ->
> nview, which I reconfigured to vim. So, now, sh -c "col -b | view -c
> 'set ft=man nomod nolist titlestring=MANPAGE' -"
> works great. I guess that solves the bug, but still stumps me why
> export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' 
> -"
> "Just Works" (tm) in sarge. Maybe the method of invoking $PAGER
> changed between sarge and sid.

 Check your sarge alternatives: perhaps the priority of nview or vim
 changed?

> And yes, also stumps me where the "-s" came from ?

 Well, this is the bug.

 I'll try to look into it, but I'm a bit busy, feel free to debug it.

   Bye,

-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Rohan Dhruva
On 4/18/06, Loïc Minier <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  You or Gmail didn't honor my Reply-To:, please drop the superfluous
>  debian-devel Cc:.

Sorry for it, now debian-devel is not being cc'ed.

>
> On Tue, Apr 18, 2006, Rohan Dhruva wrote:
> > view: -s option is only applicable to ex.
> > man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanujhMpV
> > | /usr/bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh
> > -c col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -
>
>  Please note that this is a different error than the one you reported
>  initially.  The first error your reported was caused by usage of pipes
>  in a command-line configuration option, and was solved by using sh -c,
>  the second error you're reporting is probably a bug in whatever the
>  "view" program is on your system.  On my system, I installed vim which
>  provides view, perhaps you're using something else.
>
>  Could you please send the output of:
> ls -l `which view` /etc/alternatives/view
>
>  You can also try installing "vim" and see if it fixes your bug.
>

That was exactly what I wanted in the first place, so I did have vim
installed. The problem is that, alternatives had symlinked view ->
nview, which I reconfigured to vim. So, now, sh -c "col -b | view -c
'set ft=man nomod nolist titlestring=MANPAGE' -"
works great. I guess that solves the bug, but still stumps me why
export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -"
"Just Works" (tm) in sarge. Maybe the method of invoking $PAGER
changed between sarge and sid.

> > Attached file -- man.strace
>
>  This proved that nothing is called with "-s" (exactly as in the above
>  man error message which quotes "-s option", but -s is nowhere in the
>  line).

And yes, also stumps me where the "-s" came from ?

Thanks a lot for pointing me towards alternatives,
Rohan.

--
Rohan Dhruva
Proud GNU/Linux user.
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming or what?"
http://www.dhruva.be/



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Loïc Minier
Hi,

 You or Gmail didn't honor my Reply-To:, please drop the superfluous
 debian-devel Cc:.

On Tue, Apr 18, 2006, Rohan Dhruva wrote:
> view: -s option is only applicable to ex.
> man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanujhMpV
> | /usr/bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh
> -c col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -

 Please note that this is a different error than the one you reported
 initially.  The first error your reported was caused by usage of pipes
 in a command-line configuration option, and was solved by using sh -c,
 the second error you're reporting is probably a bug in whatever the
 "view" program is on your system.  On my system, I installed vim which
 provides view, perhaps you're using something else.

 Could you please send the output of:
ls -l `which view` /etc/alternatives/view

 You can also try installing "vim" and see if it fixes your bug.

> Attached file -- man.strace

 This proved that nothing is called with "-s" (exactly as in the above
 man error message which quotes "-s option", but -s is nowhere in the
 line).

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Rohan Dhruva
On 4/18/06, Loïc Minier <[EMAIL PROTECTED]> wrote:
> reassign 363250 man-db
> retitle 363250 please clarify in the man manpage how $PAGER is invoked
> stop
>
> Hi,
>
> On Tue, Apr 18, 2006, Rohan Dhruva wrote:
> > I suggest you use:
> > export PAGER="sh -c \"col -b | view -c 'set ft=man nomod nolist
> > titlestring=MANPAGE' -\""
> > That didnt work.
>
>  It works here, under zsh as well as under bash.  Check with a new user.
>  Are you using aliases?

"test" is an absolutely new freshly created user.
[EMAIL PROTECTED]:~$ echo $PAGER
sh -c "col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -"
[EMAIL PROTECTED]:~$ man vim
Reformatting vim(1), please wait...
view: -s option is only applicable to ex.
man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanujhMpV
| /usr/bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh
-c col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -
[EMAIL PROTECTED]:~$

> > man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanqn0tzd | 
> > /usr/
> > bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh -c col -b | 
> > view
> > -c 'set ft=man nomod nolist titlestring=MANPAGE' -
>
>  I don't see anything similar being called on my system.
>
>  I suggest you run something like:
> strace -o foo.strace -f -e execve -e signal= -q -v -s 200 man vim
>  and attach the resulting foo.strace (warning: contains sensitive
>  information).

Attached file -- man.strace

>
>  Also, please mention the version of man you are using (dpkg -l man-db),
>  and your environment (env > foo.env, warning: contains sensitive
>  information).

[EMAIL PROTECTED] ~]$ dpkg -l man-db
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name  Version   Description
+++-=-=-==
ii  man-db2.4.3-3   The on-line manual pager

Attached file - man.env

Thanks for the help, in case any more information is needed, please
dont hesitate to ask. Also, the alias'es I use the are same as the
ones in other distros, including sarge. I am attaching my .bashrc too,
for reference.

Regards,
Rohan.
--
Rohan Dhruva
Proud GNU/Linux user.
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming or what?"
http://www.dhruva.be/


bashrc
Description: Binary data


man.env
Description: Binary data


man.strace
Description: Binary data


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Loïc Minier
reassign 363250 man-db
retitle 363250 please clarify in the man manpage how $PAGER is invoked
stop

Hi,

On Tue, Apr 18, 2006, Rohan Dhruva wrote:
> I suggest you use:
> export PAGER="sh -c \"col -b | view -c 'set ft=man nomod nolist
> titlestring=MANPAGE' -\""
> That didnt work.

 It works here, under zsh as well as under bash.  Check with a new user.
 Are you using aliases?

> man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanqn0tzd | /usr/
> bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh -c col -b | 
> view
> -c 'set ft=man nomod nolist titlestring=MANPAGE' -

 I don't see anything similar being called on my system.

 I suggest you run something like:
strace -o foo.strace -f -e execve -e signal= -q -v -s 200 man vim
 and attach the resulting foo.strace (warning: contains sensitive
 information).

 Also, please mention the version of man you are using (dpkg -l man-db),
 and your environment (env > foo.env, warning: contains sensitive
 information).

   Bye,

-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Rohan Dhruva
Also, IMHO, topic is a bit wrong .. this "bug" applies to all man pages, not only the "man" manpage. Regards,-- Rohan DhruvaProud GNU/Linux user.Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"FreeBSD: "Are you guys coming or what?"http://www.dhruva.be/


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Rohan Dhruva
On 4/18/06, Loïc Minier <[EMAIL PROTECTED]> wrote:
reassign 363250 manretitle 363250 Please clarify how $PAGER is invoked in the man manpagestopHi,On Tue, Apr 18, 2006, Rohan Dhruva wrote:> export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -"
 This $PAGER definition makes the assumption that it's passed to sh -c (you use pipes and quotes).  The man manpage doesn't say that $PAGER is passed to sh -c, it says it will use $PAGER as the program to display
 the manual page. I suggest you use:export PAGER="sh -c \"col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -\""That didnt work. [EMAIL PROTECTED]
 ~]$ export PAGER="sh -c \"col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -\""[EMAIL PROTECTED] ~]$ echo $PAGERsh -c "col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -"
[EMAIL PROTECTED] ~]$ man vimReformatting vim(1), please wait...view: -s option is only applicable to ex.man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanqn0tzd | /usr/bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | sh -c col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -
[EMAIL PROTECTED] ~]$ which explicitely calls sh -c to handle pipes and quotes in the
 expected way. You may also use your own /usr/local/bin/pager with:#!/bin/shcol -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' - and with PAGER=/usr/local/bin/pager.
 I am reassigning to man for the man manpage to be clarified with respect to the way $PAGER is called.Which did not work either. [EMAIL PROTECTED] ~]$ cat /usr/local/bin/vipager#!/bin/sh
col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -[EMAIL PROTECTED] ~]$ export PAGER=/usr/local/bin/vipager[EMAIL PROTECTED] ~]$ echo $PAGER/usr/local/bin/vipager[EMAIL PROTECTED] ~]$ man manReformatting man(1), please wait...
view: -s option is only applicable to ex.man: command exited with status 256: /usr/bin/zsoelim /tmp/zmansyaLax | /usr/bin/tbl | /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | /usr/local/bin/vipager[EMAIL PROTECTED]
 ~]$Thanks for the help, please keep the ideas coming :)Rohan.-- Rohan DhruvaProud GNU/Linux user.Windows: "Where do you want to go today?"Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming or what?"http://www.dhruva.be/


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Rohan Dhruva
retitle 363250 Please clarify how $PAGER is invoked for any manpage.stopSorry for the spam, I did not know I can retitle bugs myself.-- Rohan DhruvaProud GNU/Linux user.Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"FreeBSD: "Are you guys coming or what?"http://www.dhruva.be/


Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Loïc Minier
reassign 363250 man
retitle 363250 Please clarify how $PAGER is invoked in the man manpage
stop

Hi,

On Tue, Apr 18, 2006, Rohan Dhruva wrote:
> export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' 
> -"

 This $PAGER definition makes the assumption that it's passed to sh -c
 (you use pipes and quotes).  The man manpage doesn't say that $PAGER is
 passed to sh -c, it says it will use $PAGER as the program to display
 the manual page.

 I suggest you use:
export PAGER="sh -c \"col -b | view -c 'set ft=man nomod nolist 
titlestring=MANPAGE' -\""

 which explicitely calls sh -c to handle pipes and quotes in the
 expected way.

 You may also use your own /usr/local/bin/pager with:
#!/bin/sh

col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -
 and with PAGER=/usr/local/bin/pager.

 I am reassigning to man for the man manpage to be clarified with
 respect to the way $PAGER is called.

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
"You can gtk_main_run, but you can't gtk_widget_hide." --danw, 19-jul-04



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-18 Thread Martijn van Oosterhout
On 4/18/06, Rohan Dhruva <[EMAIL PROTECTED]> wrote:
> Package: general
> Severity: normal
>
> I want to use vim as my man pager. On other distros, and on sarge, I use this 
> line
> in my .bashrc
>
> # Set vim as the man pager
> export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' 
> -"

I wonder if the problem is because man is splitting the command line
itself rather than letting a shell do it. That's not a bug though...

In any case,it seems to me the best solution is to create a scrupt in
/usr/local/bin called vipager and set your pager variable to that...
--
Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/



Bug#363250: general: Custom PAGER gives error on sid, but works on sarge

2006-04-17 Thread Rohan Dhruva
Package: general
Severity: normal

I want to use vim as my man pager. On other distros, and on sarge, I use this 
line 
in my .bashrc

# Set vim as the man pager
export PAGER="col -b | view -c 'set ft=man nomod nolist titlestring=MANPAGE' -"

In those systems, it displays the man page properly in vim with full color. 
However, 
on using the same line on sid, the error given is 

[EMAIL PROTECTED] ~]$ man man
Reformatting man(1), please wait...
col: invalid option -- c
usage: col [-bfhpx] [-l nline]
man: command exited with status 256: /usr/bin/zsoelim /tmp/zmanGiFFlw | 
/usr/bin/tbl 
| /usr/bin/nroff -mandoc -rLL=89n -rLT=89n -Tutf8 | col -b | view -c set ft=man 
nomod nolist titlestring=MANPAGE -
[EMAIL PROTECTED] ~]$

I dont why it is passing -c to col, where it should pass it to "view" i.e. vim. 


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-1-686
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]