GNU bug report logs - #50852
[PATCH] Fix search of the look program.

Previous Next

Package: emacs;

Reported by: André A. Gomes <andremegafone <at> gmail.com>

Date: Mon, 27 Sep 2021 18:46:02 UTC

Severity: normal

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50852 in the body.
You can then email your comments to 50852 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Mon, 27 Sep 2021 18:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to André A. Gomes <andremegafone <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Sep 2021 18:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: André A. Gomes <andremegafone <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix search of the look program.
Date: Mon, 27 Sep 2021 21:45:30 +0300
[Message part 1 (text/plain, inline)]
Hi Emacs,

Here's a more robust way to handle the existence of the look program by
ispell.  GNU Guix users will be happy.

There's another aspect worth discussing.  The look program doesn't have
the -r flag (as of today), but ispell handles this case (look at
ispell-look-options).  It seems that look was published around 1979.
Perhaps it's time to deprecate this flag?

Thank you.


--
André A. Gomes
"Free Thought, Free World"
[0001-Fix-search-of-the-look-program.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Mon, 27 Sep 2021 23:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: André A. Gomes <andremegafone <at> gmail.com>
Cc: 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Mon, 27 Sep 2021 16:56:14 -0700
André A. Gomes <andremegafone <at> gmail.com> writes:

> Here's a more robust way to handle the existence of the look program by
> ispell.  GNU Guix users will be happy.

LGTM.  I do wonder if this shouldn't be done in many more places...

> There's another aspect worth discussing.  The look program doesn't have
> the -r flag (as of today), but ispell handles this case (look at
> ispell-look-options).  It seems that look was published around 1979.
> Perhaps it's time to deprecate this flag?

Does that apply to all versions of look or just the GNU one?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 05:55:02 GMT) Full text and rfc822 format available.

Message #11 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: André A. Gomes <andremegafone <at> gmail.com>
Cc: 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 07:54:07 +0200
André A. Gomes <andremegafone <at> gmail.com> writes:

> Here's a more robust way to handle the existence of the look program by
> ispell.  GNU Guix users will be happy.

Thanks; applied to Emacs 28 (but I made the ispell-look-p change more
defensive, in case somebody has set ispell-look-command in their init
file).

> There's another aspect worth discussing.  The look program doesn't have
> the -r flag (as of today), but ispell handles this case (look at
> ispell-look-options).  It seems that look was published around 1979.
> Perhaps it's time to deprecate this flag?

Do you know when the "-r" flag disappeared?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 28 Sep 2021 05:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 06:08:01 GMT) Full text and rfc822 format available.

Message #16 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: andremegafone <at> gmail.com, 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 09:07:26 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Mon, 27 Sep 2021 16:56:14 -0700
> Cc: 50852 <at> debbugs.gnu.org
> 
> André A. Gomes <andremegafone <at> gmail.com> writes:
> 
> > Here's a more robust way to handle the existence of the look program by
> > ispell.  GNU Guix users will be happy.
> 
> LGTM.  I do wonder if this shouldn't be done in many more places...

Careful: that will subtly change the behavior.  For starters,
executable-find looks in exec-path, which includes Emacs-specific
directories.  It also has its own ideas about which files are
executable and whether to try some extensions.  And finally,
executable-find could return nil, whereas the original value was never
nil, which could cause some code to signal an error, and requires the
user to redefine the value when a program was originally absent, but
is then installed without restarting Emacs.

I'm not saying these differences are for the worse, but they need to
be carefully considered when making such "innocent" changes, as they
could introduce subtle bugs and misfeatures, at least potentially.

In this case, why not simply have the value as "look" with no leading
directories?  If the program is installed, it will be found when it's
invoked, and if it isn't installed, the user gets an error message at
that time.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 06:12:01 GMT) Full text and rfc822 format available.

Message #19 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: andremegafone <at> gmail.com, 50852 <at> debbugs.gnu.org,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 08:11:18 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> In this case, why not simply have the value as "look" with no leading
> directories?  If the program is installed, it will be found when it's
> invoked, and if it isn't installed, the user gets an error message at
> that time.

That's a good point.  And the ispell-look-p variable is itself rather
odd -- why have both ispell-look-command and that variable (with a
non-standard name)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 07:16:02 GMT) Full text and rfc822 format available.

Message #22 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: andremegafone <at> gmail.com, 50852 <at> debbugs.gnu.org, stefan <at> marxist.se
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 10:15:06 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Stefan Kangas <stefan <at> marxist.se>,  andremegafone <at> gmail.com,
>   50852 <at> debbugs.gnu.org
> Date: Tue, 28 Sep 2021 08:11:18 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > In this case, why not simply have the value as "look" with no leading
> > directories?  If the program is installed, it will be found when it's
> > invoked, and if it isn't installed, the user gets an error message at
> > that time.
> 
> That's a good point.  And the ispell-look-p variable is itself rather
> odd -- why have both ispell-look-command and that variable (with a
> non-standard name)?

Right.  The existence of "look" should IMO be tested as part of
ispell-lookup-words, not when the package loads.  Then the command
could decide whether to use "look" or Grep at that time, and the need
for the ispell-look-p variable would disappear.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 08:33:01 GMT) Full text and rfc822 format available.

Message #25 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: André A. Gomes <andremegafone <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 11:32:39 +0300
Stefan Kangas <stefan <at> marxist.se> writes:

>> There's another aspect worth discussing.  The look program doesn't have
>> the -r flag (as of today), but ispell handles this case (look at
>> ispell-look-options).  It seems that look was published around 1979.
>> Perhaps it's time to deprecate this flag?
>
> Does that apply to all versions of look or just the GNU one?

I don't think there's a GNU one, since it's not part of the GNU
coreutils.

Here's what the man page say:

--8<---------------cut here---------------start------------->8---
The look utility appeared in Version 7 AT&T Unix.

The look command is part of the util-linux  package  and  is  available
       from https://www.kernel.org/pub/linux/utils/util-linux/.
--8<---------------cut here---------------end--------------->8---

From the first sentence I inferred that it appeared in 1979.

I had a look at the "look" program both on my GNU/Linux machine and on a
modern Mac laptop.  Both have the same "look", none have the "-r" flag.


-- 
André A. Gomes
"Free Thought, Free World"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 08:42:02 GMT) Full text and rfc822 format available.

Message #28 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: André A. Gomes <andremegafone <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 50852 <at> debbugs.gnu.org,
 stefan <at> marxist.se
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 11:41:38 +0300
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Cc: Stefan Kangas <stefan <at> marxist.se>,  andremegafone <at> gmail.com,
>>   50852 <at> debbugs.gnu.org
>> Date: Tue, 28 Sep 2021 08:11:18 +0200
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> > In this case, why not simply have the value as "look" with no leading
>> > directories?  If the program is installed, it will be found when it's
>> > invoked, and if it isn't installed, the user gets an error message at
>> > that time.
>> 
>> That's a good point.  And the ispell-look-p variable is itself rather
>> odd -- why have both ispell-look-command and that variable (with a
>> non-standard name)?
>
> Right.  The existence of "look" should IMO be tested as part of
> ispell-lookup-words, not when the package loads.  Then the command
> could decide whether to use "look" or Grep at that time, and the need
> for the ispell-look-p variable would disappear.

You're both right.  I was actually silly.  I can prepare a patch
following these ideas.


-- 
André A. Gomes
"Free Thought, Free World"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 09:03:02 GMT) Full text and rfc822 format available.

Message #31 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: André A. Gomes <andremegafone <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 12:02:35 +0300
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> André A. Gomes <andremegafone <at> gmail.com> writes:
>
>> Here's a more robust way to handle the existence of the look program by
>> ispell.  GNU Guix users will be happy.
>
> Thanks; applied to Emacs 28 (but I made the ispell-look-p change more
> defensive, in case somebody has set ispell-look-command in their init
> file).

Makes sense.  I was naive.

>> There's another aspect worth discussing.  The look program doesn't have
>> the -r flag (as of today), but ispell handles this case (look at
>> ispell-look-options).  It seems that look was published around 1979.
>> Perhaps it's time to deprecate this flag?
>
> Do you know when the "-r" flag disappeared?

That's a good question.  As mentioned above, look is the same in both
MacOS and GNU/Linux.

The -r flag stands for regexp.  It seems odd that a binary search
program like look would support regexp.

My intuition tells me that once upon a time there was a programme named
look whose behaviour resembles that of grep.  But what does a kid like
me know about Unix and the dinosaurs anyway? :)

I'd deprecate support for this odd flag.  But ispell-lookup-words should
definitely use look, by default, instead of grep.   


-- 
André A. Gomes
"Free Thought, Free World"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 09:16:01 GMT) Full text and rfc822 format available.

Message #34 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: André A. Gomes <andremegafone <at> gmail.com>
Cc: larsi <at> gnus.org, 50852 <at> debbugs.gnu.org, stefan <at> marxist.se
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 12:15:38 +0300
> From: André A. Gomes <andremegafone <at> gmail.com>
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,  stefan <at> marxist.se,
>   50852 <at> debbugs.gnu.org
> Date: Tue, 28 Sep 2021 11:41:38 +0300
> 
> I can prepare a patch following these ideas.

I think it will be appreciated, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Tue, 28 Sep 2021 11:07:02 GMT) Full text and rfc822 format available.

Message #37 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: André A. Gomes <andremegafone <at> gmail.com>
Cc: 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Tue, 28 Sep 2021 04:06:48 -0700
André A. Gomes <andremegafone <at> gmail.com> writes:

> I don't think there's a GNU one, since it's not part of the GNU
> coreutils.
>
> Here's what the man page say:
>
> --8<---------------cut here---------------start------------->8---
> The look utility appeared in Version 7 AT&T Unix.
>
> The look command is part of the util-linux  package  and  is  available
>        from https://www.kernel.org/pub/linux/utils/util-linux/.
> --8<---------------cut here---------------end--------------->8---
>
> From the first sentence I inferred that it appeared in 1979.
>
> I had a look at the "look" program both on my GNU/Linux machine and on a
> modern Mac laptop.  Both have the same "look", none have the "-r" flag.

Maybe it's better to make all that stuff obsolete, indeed.

But I do wonder why the "-r" parameter was added.  It seems like it
depends on the `ispell-have-new-look' variable, added in the initial
revision in 1994 (commit 007852e00dd8).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Sat, 30 Oct 2021 16:10:01 GMT) Full text and rfc822 format available.

Message #40 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: André A. Gomes <andremegafone <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 50852 <at> debbugs.gnu.org,
 Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Sat, 30 Oct 2021 09:09:34 -0700
André A. Gomes <andremegafone <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>>> Cc: Stefan Kangas <stefan <at> marxist.se>,  andremegafone <at> gmail.com,
>>>   50852 <at> debbugs.gnu.org
>>> Date: Tue, 28 Sep 2021 08:11:18 +0200
>>>
>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>>
>>> > In this case, why not simply have the value as "look" with no leading
>>> > directories?  If the program is installed, it will be found when it's
>>> > invoked, and if it isn't installed, the user gets an error message at
>>> > that time.
>>>
>>> That's a good point.  And the ispell-look-p variable is itself rather
>>> odd -- why have both ispell-look-command and that variable (with a
>>> non-standard name)?
>>
>> Right.  The existence of "look" should IMO be tested as part of
>> ispell-lookup-words, not when the package loads.  Then the command
>> could decide whether to use "look" or Grep at that time, and the need
>> for the ispell-look-p variable would disappear.
>
> You're both right.  I was actually silly.  I can prepare a patch
> following these ideas.

It seems like we are still waiting for this patch.  So here's a friendly
reminder to take a look at this when you find some time.  :-)

Thanks in advance.




Removed tag(s) patch and moreinfo. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 30 Oct 2021 16:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50852; Package emacs. (Fri, 02 Sep 2022 11:36:01 GMT) Full text and rfc822 format available.

Message #45 received at 50852 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: "André A. Gomes" <andremegafone <at> gmail.com>,
 50852 <at> debbugs.gnu.org
Subject: Re: bug#50852: [PATCH] Fix search of the look program.
Date: Fri, 02 Sep 2022 13:35:10 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Maybe it's better to make all that stuff obsolete, indeed.

I've now done so in Emacs 29.





bug marked as fixed in version 29.1, send any further explanations to 50852 <at> debbugs.gnu.org and André A. Gomes <andremegafone <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Sep 2022 11:36:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 01 Oct 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.