Bug#397191: less is trying to be too smart on .doc files

2009-04-19 Thread Charles Plessy
Le Sat, Apr 18, 2009 at 12:28:51AM +1000, Aníbal Monsalve Salazar a écrit :
> On Fri, Apr 17, 2009 at 11:17:23PM +0900, Charles Plessy wrote:
> >Maybe `which catdoc` returns something on your system ?
> 
> dpkg -l less | grep less
> ii  less  418-1 Pager program similar to more
> 
> which which; echo $?
> /usr/bin/which
> 0
> 
> which catdoc; echo $?
> 1

Hi Aníbal,

I have found the reason for the difference: I had LESSOPEN set to '|
/usr/bin/lesspipe %s' in my environment, because I forgot that I uncommented
the following line in my .bashrc:

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

Have a nice Sunday,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan



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



Bug#397191: less is trying to be too smart on .doc files

2009-04-17 Thread Fabrice Lorrain

Aníbal Monsalve Salazar a écrit :

On Fri, Feb 15, 2008 at 10:01:00AM +0900, Charles Plessy wrote:

Le Thu, Feb 14, 2008 at 03:11:23PM +, Steve Kemp a écrit :

 This is very annoying, and I've been bitten by it several times.

 There are two cases:

   1.  You try to run "less foo.doc" when catdoc is installed.
   ->  This works for both MS-Word documents and plain text.

   2.  You try to run "less foo.doc" when catdoc is not installed.
   -> This fails with an error.

Hi all,

by the way, shouldn't the `less' package Recommend: or at least
Suggest: catdoc?

Also, while we are at modifying /usr/bin/lesspipe, maybe the error
message could make it clearer that catdoc is a program from the
`catdoc' package. (I have been using antiword for such a long time that
I forgot that it was a program name..).




Hello Anibal,


I couldn't reproduce this bug with less 418-1.


I can. I got the same result than Charles Plessy.

Thanks.

@+,
Fab



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



Bug#397191: less is trying to be too smart on .doc files

2009-04-17 Thread Aníbal Monsalve Salazar
On Fri, Apr 17, 2009 at 11:17:23PM +0900, Charles Plessy wrote:
>Hi Aníbal, how is it going ?

Good, thanks. :)

>Maybe `which catdoc` returns something on your system ?

dpkg -l less | grep less
ii  less  418-1 Pager program similar to more

which which; echo $?
/usr/bin/which
0

which catdoc; echo $?
1



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



Bug#397191: less is trying to be too smart on .doc files

2009-04-17 Thread Charles Plessy
Hi Aníbal, how is it going ?

Le Sat, Apr 18, 2009 at 12:01:54AM +1000, Aníbal Monsalve Salazar a écrit :
> I couldn't reproduce this bug with less 418-1.
> 
> catdoc
> -bash: catdoc: command not found
> 
> echo some_texte_in_a_dummy_file > /tmp/foo.doc
> 
> less /tmp/foo.doc
> some_texte_in_a_dummy_file

Interesting…

anx159《~》$ dpkg -l less | grep less
ii  less418-1 Pager 
program similar to more
anx159《~》$ echo "Hello Anibal" > hello.doc
anx159《~》$ less hello.doc 

…gives me the following in less:

No catdoc available
hello.doc (END) 

I have no explanation for the moment. /usr/bin/lessfile contains instructions
that explicitely seek for catdoc:

anx159《~》$ grep -B2 -A1 catdoc /usr/bin/lessfile

*.doc)
if [ -x "`which catdoc`" ]; then catdoc "$1"
else echo "No catdoc available"; fi ;;


Maybe `which catdoc` returns something on your system ?

Have a nice day,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan



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



Bug#397191: less is trying to be too smart on .doc files

2009-04-17 Thread Aníbal Monsalve Salazar
On Fri, Feb 15, 2008 at 10:01:00AM +0900, Charles Plessy wrote:
>Le Thu, Feb 14, 2008 at 03:11:23PM +, Steve Kemp a écrit :
>>  This is very annoying, and I've been bitten by it several times.
>>
>>  There are two cases:
>>
>>1.  You try to run "less foo.doc" when catdoc is installed.
>>->  This works for both MS-Word documents and plain text.
>>
>>2.  You try to run "less foo.doc" when catdoc is not installed.
>>-> This fails with an error.
>
>Hi all,
>
>by the way, shouldn't the `less' package Recommend: or at least
>Suggest: catdoc?
>
>Also, while we are at modifying /usr/bin/lesspipe, maybe the error
>message could make it clearer that catdoc is a program from the
>`catdoc' package. (I have been using antiword for such a long time that
>I forgot that it was a program name..).

I couldn't reproduce this bug with less 418-1.

catdoc
-bash: catdoc: command not found

echo some_texte_in_a_dummy_file > /tmp/foo.doc

less /tmp/foo.doc
some_texte_in_a_dummy_file



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



Bug#397191: less is trying to be too smart on .doc files

2008-02-14 Thread Charles Plessy
Le Thu, Feb 14, 2008 at 03:11:23PM +, Steve Kemp a écrit :
>   This is very annoying, and I've been bitten by it several times.
> 
>   There are two cases:
> 
> 1.  You try to run "less foo.doc" when catdoc is installed.
> ->  This works for both MS-Word documents and plain text.
> 
> 2.  You try to run "less foo.doc" when catdoc is not installed.
> -> This fails with an error.

Hi all,

by the way, shouldn't the `less' package Recommend: or at least Suggest:
catdoc?

Also, while we are at modifying /usr/bin/lesspipe, maybe the error
message could make it clearer that catdoc is a program from the
`catdoc' package. (I have been using antiword for such a long time that
I forgot that it was a program name…).

Have a nice day,

-- 
Charles Plessy
http://charles.plessy.org
Wakō, Saitama, Japan




Bug#397191: less is trying to be too smart on .doc files

2008-02-14 Thread Steve Kemp
  This is very annoying, and I've been bitten by it several times.

  There are two cases:

1.  You try to run "less foo.doc" when catdoc is installed.
->  This works for both MS-Word documents and plain text.

2.  You try to run "less foo.doc" when catdoc is not installed.
-> This fails with an error.

  I'd expect the second case to work *if* the file is plain text,
 otherwise I'd expect it to say something like "The file you're
 attempting to view is binary ...blahblah".

  So, my solution:

  If catdoc is installed
 [run catdoc]
  else
 If the file is ASCII 
view it
 else
give errror

  The patch is attached below.  It could be improved to use cat in
 both the cases where catdoc is not installed, that way it would
 show the binary file - but I couldn't decide whether to do that
 or not.

Steve
-- 

--- lesspipe.orig 2008-02-14 15:05:38.0 +
+++ lesspipe2008-02-14 15:06:51.0 +
@@ -101,8 +101,15 @@
;;
 
*.doc)
-   if [ -x "`which catdoc`" ]; then catdoc "$1"
-   else echo "No catdoc available"; fi ;;
+   if [ -x "`which catdoc`" ]; then 
+catdoc "$1"
+   else
+# no catdoc? read normally if file is text.
+if ( file "$1" | grep ASCII 2>/dev/null 
>/dev/null); then
+cat "$1"
+fi
+echo "No catdoc available"; 
+fi ;;
 
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
if [ -x "`which identify`" ]; then






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



Bug#397191: less is trying to be too smart on .doc files

2007-05-16 Thread Matt Taggart
I also ran into this bug recently, and it's not clear when it happens
that it's an error, you're just put in the normal less buffer and it
says "No catdoc available" which at first made me assume that was the
contents of the file.

Unlike the original submitter, my file actually was an MS Word file
format file, but like the original submitter the problem was that
catdoc wasn't installed and less was trying to be clever.

If less is going to be clever,

1.) I agree with the original submitter that it shouldn't pay attention
to filename extensions. Maybe use libmagic instead?

2.) If catdoc doesn't exist then it should either
  a.) fall back to the same behavior as more (just display the raw
contents)
  b.) do what ISTR it doing in the past and asking if I really want to
display a binary file
  c.) throw a real error explaining that you can't use less on MS Word
doc files until you install catdoc

Thanks,

-- 
Matt Taggart
[EMAIL PROTECTED]


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



Bug#397191: less is trying to be too smart on .doc files

2006-11-05 Thread Fabrice Lorrain
Package: less
Version: 394-4
Severity: normal

Hello,

Trying to read {syslinux,isolinux}.doc files I got a suboptimal answer
from less :

$ less syslinux.doc 
No catdoc available
syslinux.doc (END) 

You can reproduce the pb with the following :
$ echo some_texte_in_a_dummy_file > /tmp/foo.doc
$ less /tmp/foo.doc
No catdoc available
/tmp/foo.doc (END)

cat & more are working correctly on those files.

If less is making assumption on file type through file extensions... it's
improvable.

@+,

Fab

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-1-k7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages less depends on:
ii  debianutils  2.17.3  Miscellaneous utilities specific t
ii  libc62.3.6.ds1-7 GNU C Library: Shared libraries
ii  libncurses5  5.5-5   Shared libraries for terminal hand

less recommends no packages.

-- no debconf information


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