all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Making substitute* throw an error if substition failed?
@ 2016-10-14 22:05 Ricardo Wurmus
  2016-10-15  7:53 ` Hartmut Goebel
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ricardo Wurmus @ 2016-10-14 22:05 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

it happened a couple of times already that a “substitute*” expression
silently failed and I only found out about it when investigating the
remains of a failing build (“guix build -K”).  This can easily happen
when a package is updated and substitutions “anchors” no longer exist in
the updated source code.

Would it be desirable to change “substitute*” (or replace it) such that
it throws an error or returns a value if substitution failed?  This
might be helpful for the more complex packages with many substitutions.
If we make it return a value (#f for error) it would also make our build
phases a little prettier, I think.  (Now we forcefully return #t in any
case and that seems wrong.)

~~ Ricardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
@ 2016-10-15  7:53 ` Hartmut Goebel
  2016-10-15  8:06 ` Danny Milosavljevic
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Hartmut Goebel @ 2016-10-15  7:53 UTC (permalink / raw)
  To: guix-devel

Am 15.10.2016 um 00:05 schrieb Ricardo Wurmus:
> Would it be desirable to change “substitute*” (or replace it) such that
> it throws an error or returns a value if substitution failed?  This

+1 for returning a value

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
  2016-10-15  7:53 ` Hartmut Goebel
@ 2016-10-15  8:06 ` Danny Milosavljevic
  2016-10-15 17:07 ` Alex Kost
  2016-10-17  8:50 ` Ludovic Courtès
  3 siblings, 0 replies; 7+ messages in thread
From: Danny Milosavljevic @ 2016-10-15  8:06 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi,

On Sat, 15 Oct 2016 00:05:56 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:
> Would it be desirable to change “substitute*” (or replace it) such that
> it throws an error or returns a value if substitution failed?  This
> might be helpful for the more complex packages with many substitutions.
> If we make it return a value (#f for error) it would also make our build
> phases a little prettier, I think.  (Now we forcefully return #t in any
> case and that seems wrong.)

While it's a big change I am for substitute* throwing an error if it can't find one of the patterns - and #t otherwise. It's true that these substitutions that are necessary but cannot be found would not be noticed in a long time otherwise.

I'm against it returning a value #f in the error case - it should just unwind. If you don't want it to unwind (in a few cases) you can always protect against it manually.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
  2016-10-15  7:53 ` Hartmut Goebel
  2016-10-15  8:06 ` Danny Milosavljevic
@ 2016-10-15 17:07 ` Alex Kost
  2016-10-17  8:50 ` Ludovic Courtès
  3 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2016-10-15 17:07 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus (2016-10-15 00:05 +0200) wrote:

> Hi Guix,
>
> it happened a couple of times already that a “substitute*” expression
> silently failed and I only found out about it when investigating the
> remains of a failing build (“guix build -K”).  This can easily happen
> when a package is updated and substitutions “anchors” no longer exist in
> the updated source code.
>
> Would it be desirable to change “substitute*” (or replace it) such that
> it throws an error or returns a value if substitution failed?  This
> might be helpful for the more complex packages with many substitutions.
> If we make it return a value (#f for error) it would also make our build
> phases a little prettier, I think.  (Now we forcefully return #t in any
> case and that seems wrong.)

This was also discussed a bit around here:
<http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01844.html>.
As I mentioned in that message, I'm for returning #t/#f for
succeeded/failed substitution.

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
                   ` (2 preceding siblings ...)
  2016-10-15 17:07 ` Alex Kost
@ 2016-10-17  8:50 ` Ludovic Courtès
  2016-10-17 21:08   ` Efraim Flashner
  3 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2016-10-17  8:50 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi,

Ricardo Wurmus <rekado@elephly.net> skribis:

> it happened a couple of times already that a “substitute*” expression
> silently failed and I only found out about it when investigating the
> remains of a failing build (“guix build -K”).  This can easily happen
> when a package is updated and substitutions “anchors” no longer exist in
> the updated source code.
>
> Would it be desirable to change “substitute*” (or replace it) such that
> it throws an error or returns a value if substitution failed?

“Failed” as in “there were no pattern matches”, right?

> This might be helpful for the more complex packages with many
> substitutions.  If we make it return a value (#f for error) it would
> also make our build phases a little prettier, I think.  (Now we
> forcefully return #t in any case and that seems wrong.)

I like this idea.  Like others wrote, it could return #t if one or more
substitutions were made, and #f otherwise.

I think it’s better than throwing an error, because there are cases
where it doesn’t matter whether a substitution was made or not (e.g.,
when replacing strings en masse on a set of files.)

WDYT?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-17  8:50 ` Ludovic Courtès
@ 2016-10-17 21:08   ` Efraim Flashner
  2016-10-18 12:41     ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2016-10-17 21:08 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]

On Mon, Oct 17, 2016 at 10:50:36AM +0200, Ludovic Courtès wrote:
> Hi,
> 
> Ricardo Wurmus <rekado@elephly.net> skribis:
> 
> > it happened a couple of times already that a “substitute*” expression
> > silently failed and I only found out about it when investigating the
> > remains of a failing build (“guix build -K”).  This can easily happen
> > when a package is updated and substitutions “anchors” no longer exist in
> > the updated source code.
> >
> > Would it be desirable to change “substitute*” (or replace it) such that
> > it throws an error or returns a value if substitution failed?
> 
> “Failed” as in “there were no pattern matches”, right?
> 

Or as in "your regex was bad, try again"

> > This might be helpful for the more complex packages with many
> > substitutions.  If we make it return a value (#f for error) it would
> > also make our build phases a little prettier, I think.  (Now we
> > forcefully return #t in any case and that seems wrong.)
> 
> I like this idea.  Like others wrote, it could return #t if one or more
> substitutions were made, and #f otherwise.
> 
> I think it’s better than throwing an error, because there are cases
> where it doesn’t matter whether a substitution was made or not (e.g.,
> when replacing strings en masse on a set of files.)
> 
> WDYT?
> 
> Thanks,
> Ludo’.
> 

I would go with '#t if one or more subsitutions were made, regardless of
the number of files specified' rather than '#t if 1+ substitutions on
every (all) file listed'.


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Making substitute* throw an error if substition failed?
  2016-10-17 21:08   ` Efraim Flashner
@ 2016-10-18 12:41     ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2016-10-18 12:41 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel

Efraim Flashner <efraim@flashner.co.il> skribis:

> On Mon, Oct 17, 2016 at 10:50:36AM +0200, Ludovic Courtès wrote:
>> Hi,
>> 
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>> 
>> > it happened a couple of times already that a “substitute*” expression
>> > silently failed and I only found out about it when investigating the
>> > remains of a failing build (“guix build -K”).  This can easily happen
>> > when a package is updated and substitutions “anchors” no longer exist in
>> > the updated source code.
>> >
>> > Would it be desirable to change “substitute*” (or replace it) such that
>> > it throws an error or returns a value if substitution failed?
>> 
>> “Failed” as in “there were no pattern matches”, right?
>> 
>
> Or as in "your regex was bad, try again"

That already happens.

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-18 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 22:05 Making substitute* throw an error if substition failed? Ricardo Wurmus
2016-10-15  7:53 ` Hartmut Goebel
2016-10-15  8:06 ` Danny Milosavljevic
2016-10-15 17:07 ` Alex Kost
2016-10-17  8:50 ` Ludovic Courtès
2016-10-17 21:08   ` Efraim Flashner
2016-10-18 12:41     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.