Re: PYTHONPATH - let's systematically tame the baest

2018-04-19 Thread Ricardo Wurmus

Hi Hartmut,

> let's pick up on this issue and systematically design the test-cases to
> benchmark the proposed solutions. I already prepared a test-script to
> simplify this and will provide a full description as later.

Thank you for picking up the work on this!

In all of the tests do we only care about the reported value of
site-packages?  Should the tests include loading non-trivial packages
that have other Python packages as dependencies?

> 2.3 Installed package *without setting the environment variables!*
>
>  guix package -i python && ~/.guix-profile/bin/python3 testit
>  --> Expected outcome: site-packages from ~/.guix-profile/
>  --> Shall this work, too? Is it nice-to-have or useless?

2.3b is to install the package into a separate profile with

guix package -p /path/to/somewhere -i python

> 2.4 running from /gnu/store (directly)
>
>   $(readlink -f ~/.guix-profile/bin/python3) testit
>  --> Expected outcome: site-packages from /gnu/store
>   --> What is the expected outcome? What is the expected
>
> 2.5 running from /gnu/store (via link)
>
>   ln -s $(readlink -f ~/.guix-profile/bin/python3)
> /tmp/test-guix-pythonA.exe ;
>  /tmp/test-guix-pythonA.exe testit
>  --> Expected outcome: site-packages from /gnu/store

I think these two cases should yield the same result.

> 2.6 Installed in GuixSD
>
>  --> Do we need to test this? Or is this already covered by one of
> the other cases?

I don’t think we need to test this as GuixSD does not have any special
behaviour for Python and the system profile is just another profile.
This would be the same as 2.3b.

--
Ricardo





Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Ludovic Courtès
Hello Roel,

Roel Janssen  skribis:

> Roel Janssen  writes:
>
>> Ludovic Courtès  writes:

[...]

>>> In this case, I thought guix-daemon could explicitly check whether the
>>> peer is remote, and disable GC in that case.  That is, ‘guix gc’ would
>>> still work locally on the machine that runs guix-daemon, but it would no
>>> longer work remotely.
>>>
>>> How does that sound?
>>
>> That sounds like it solves our use-case, but only because in our
>> case the access to the machine running guix-daemon is limited.
>>
>> So, even though I'm not sure how to implement this, your solution is
>> fine with me.
>
> I implemented the solution in the attached patch.  When a connection
> does not come from the UNIX socket, it is treated as “remote”.  So,
> local TCP connections would also be treated as “remote”.

Excellent!

> I assumed ‘collectGarbage()’ is the entry point for all garbage collection,
> is that correct?

Yes.

> From 00f489d6303720c65571fdf0bc9ee810a20f70e0 Mon Sep 17 00:00:00 2001
> From: Roel Janssen 
> Date: Wed, 11 Apr 2018 09:52:11 +0200
> Subject: [PATCH] guix-daemon: Disable garbage collection for remote hosts.
>
> * nix/libstore/gc.cc (collectGarbage): Check for remote connections.
> * nix/libstore/globals.hh: Add isRemoteConnection setting.
> * nix/nix-daemon/nix-daemon.cc (performOp): Display appropriate error message;
>   (acceptConnection): Set isRemoteConnection when connection is over TCP.

[...]

> --- a/nix/libstore/gc.cc
> +++ b/nix/libstore/gc.cc
> @@ -595,6 +595,10 @@ void LocalStore::removeUnusedLinks(const GCState & state)
>  
>  void LocalStore::collectGarbage(const GCOptions & options, GCResults & 
> results)
>  {
> +if (settings.isRemoteConnection) {
> +return;
> +}

I think this is unnecessary since the daemon already checks for that.
(It’s also nicer to keep ‘LocalStore’ unaware of the connection
details.)

> diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
> index deb7003d7..65770ba95 100644
> --- a/nix/nix-daemon/nix-daemon.cc
> +++ b/nix/nix-daemon/nix-daemon.cc
> @@ -529,6 +529,11 @@ static void performOp(bool trusted, unsigned int 
> clientVersion,
>  }
>  
>  case wopCollectGarbage: {
> +if (settings.isRemoteConnection) {
> +throw Error("Garbage collection is disabled for remote hosts.");
> +break;
> +}
>  GCOptions options;
>  options.action = (GCOptions::GCAction) readInt(from);
>  options.pathsToDelete = readStorePaths(from);

I was wondering if we would like to allow some of the ‘GCAction’ values,
but maybe it’s better to disallow them altogether like this code does.

> @@ -934,6 +939,7 @@ static void acceptConnection(int fdSocket)
> connection.  Setting these to -1 means: do not change.  */
>  settings.clientUid = clientUid;
>   settings.clientGid = clientGid;
> +settings.isRemoteConnection = (remoteAddr.ss_family != 
> AF_UNIX);

I think you can make ‘isRemoteConnection’ a static global variable in
nix-daemon.cc instead of adding it to ‘Settings’.  So it would do
something like:

--8<---cut here---start->8---
/* Fork a child to handle the connection. */
startProcess([&]() {
close(fdSocket);

/* Background the daemon. */
if (setsid() == -1)
throw SysError(format("creating a new session"));

/* Restore normal handling of SIGCHLD. */
setSigChldAction(false);

/* For debugging, stuff the pid into argv[1]. */
if (clientPid != -1 && argvSaved[1]) {
string processName = std::to_string(clientPid);
strncpy(argvSaved[1], processName.c_str(), 
strlen(argvSaved[1]));
}

isRemoteConnection = …;  /*  <– this is the new line */

/* Store the client's user and group for this connection. This
   has to be done in the forked process since it is per
   connection.  Setting these to -1 means: do not change.  */
settings.clientUid = clientUid;
settings.clientGid = clientGid;
--8<---cut here---end--->8---

Last thing: could you add a couple of tests?  tests/guix-daemon.sh
already has tests for ‘--listen’, so you could take inspiration from
those.

Thank you!

Ludo’.



Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Roel Janssen

Ludovic Courtès  writes:

> Hello Roel,
>
> Roel Janssen  skribis:
>

[...]

>
>> From 00f489d6303720c65571fdf0bc9ee810a20f70e0 Mon Sep 17 00:00:00 2001
>> From: Roel Janssen 
>> Date: Wed, 11 Apr 2018 09:52:11 +0200
>> Subject: [PATCH] guix-daemon: Disable garbage collection for remote hosts.
>>
>> * nix/libstore/gc.cc (collectGarbage): Check for remote connections.
>> * nix/libstore/globals.hh: Add isRemoteConnection setting.
>> * nix/nix-daemon/nix-daemon.cc (performOp): Display appropriate error 
>> message;
>>   (acceptConnection): Set isRemoteConnection when connection is over TCP.
>
> [...]
>
>> --- a/nix/libstore/gc.cc
>> +++ b/nix/libstore/gc.cc
>> @@ -595,6 +595,10 @@ void LocalStore::removeUnusedLinks(const GCState & 
>> state)
>>  
>>  void LocalStore::collectGarbage(const GCOptions & options, GCResults & 
>> results)
>>  {
>> +if (settings.isRemoteConnection) {
>> +return;
>> +}
>
> I think this is unnecessary since the daemon already checks for that.
> (It’s also nicer to keep ‘LocalStore’ unaware of the connection
> details.)

Right.  It is indeed unnecessary.  In the updated patch, I no longer do this.

>
>> diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
>> index deb7003d7..65770ba95 100644
>> --- a/nix/nix-daemon/nix-daemon.cc
>> +++ b/nix/nix-daemon/nix-daemon.cc
>> @@ -529,6 +529,11 @@ static void performOp(bool trusted, unsigned int 
>> clientVersion,
>>  }
>>  
>>  case wopCollectGarbage: {
>> +if (settings.isRemoteConnection) {
>> +throw Error("Garbage collection is disabled for remote hosts.");
>> +break;
>> +}
>>  GCOptions options;
>>  options.action = (GCOptions::GCAction) readInt(from);
>>  options.pathsToDelete = readStorePaths(from);
>
> I was wondering if we would like to allow some of the ‘GCAction’ values,
> but maybe it’s better to disallow them altogether like this code does.

Could we please start with a “disable any GC” and start allowing cases
on a case-by-case basis?  The reason I request this, is because it makes
it a lot easier to reason about it from a sysadmin point-of-view.

I'd like to think of it like this: “Garbage collection is effectively
turned off.”.  With the current patch, we can reason about it this way.

>
>> @@ -934,6 +939,7 @@ static void acceptConnection(int fdSocket)
>> connection.  Setting these to -1 means: do not change.  
>> */
>>  settings.clientUid = clientUid;
>>  settings.clientGid = clientGid;
>> +settings.isRemoteConnection = (remoteAddr.ss_family != 
>> AF_UNIX);
>
> I think you can make ‘isRemoteConnection’ a static global variable in
> nix-daemon.cc instead of adding it to ‘Settings’.  So it would do
> something like:
>
> --8<---cut here---start->8---
>   /* Fork a child to handle the connection. */
>   startProcess([&]() {
> close(fdSocket);
>
> /* Background the daemon. */
> if (setsid() == -1)
> throw SysError(format("creating a new session"));
>
> /* Restore normal handling of SIGCHLD. */
> setSigChldAction(false);
>
> /* For debugging, stuff the pid into argv[1]. */
> if (clientPid != -1 && argvSaved[1]) {
> string processName = std::to_string(clientPid);
> strncpy(argvSaved[1], processName.c_str(), 
> strlen(argvSaved[1]));
> }
>
> isRemoteConnection = …;  /*  <– this is the new line */
>
> /* Store the client's user and group for this connection. This
>has to be done in the forked process since it is per
>connection.  Setting these to -1 means: do not change.  */
> settings.clientUid = clientUid;
>   settings.clientGid = clientGid;
> --8<---cut here---end--->8---

Right.  I implemented it using a static global variable in
nix-daemon.cc.  This patch gets shorter and shorter. :)

>
> Last thing: could you add a couple of tests?  tests/guix-daemon.sh
> already has tests for ‘--listen’, so you could take inspiration from
> those.

I included a test, but I don't know how I can properly run this test.
Could you elaborate on how I can test the test(s)?

Kind regards,
Roel Janssen

>From b29d3a90e1487ebda5ac5b6bc146f8c95218eab6 Mon Sep 17 00:00:00 2001
From: Roel Janssen 
Date: Thu, 19 Apr 2018 14:01:49 +0200
Subject: [PATCH] guix-daemon: Disable garbage collection for remote hosts.

* nix/nix-daemon/nix-daemon.cc (performOp): Display appropriate error message;
  (acceptConnection): Set isRemoteConnection when connection is over TCP.
* tests/guix-daemon.sh: Add a test for the new behavior.
---
 nix/nix-daemon/nix-daemon.cc | 10 +-
 tests/guix-daemon.sh | 14 ++
 2 files chan

Re: staging evaluation in progress

2018-04-19 Thread Mark H Weaver
Hi Marius,

Marius Bakke  writes:

> I just started a 'staging' evaluation:
>
> https://hydra.gnu.org/jobset/gnu/staging
>
> Fairly minor changes this round, highlights include Wayland 1.15 and
> GStreamer 1.14.  We narrowly missed Mesa 17.3.9 which was scheduled for
> today but delayed, hopefully 17.3.8 doesn't introduce any new bugs.
>
> Results should start ticking in tomorrow.

The main issue I see so far is that 'gst-plugins-base' seems to
consistently fail the "elements/opus" test on i686-linux.  It failed
twice in a row, anyway:

  https://hydra.gnu.org/build/2635798

Thanks for working on it.

  Mark



Re: 03/07: gnu: libfive: Add snippet, enable tests and remove obsolete phase.

2018-04-19 Thread Mark H Weaver
Hi Ludovic,

l...@gnu.org (Ludovic Courtès) writes:

> civodul pushed a commit to branch master
> in repository guix.
>
> commit 0818c01aefbaa7ecce5e310ec5f70886850a7f9c
> Author: Diego Nicola Barbato 
> Date:   Fri Apr 6 13:43:54 2018 +0200
>
> gnu: libfive: Add snippet, enable tests and remove obsolete phase.
> 
> * gnu/packages/engineering.scm (libfive)[source]: Add snippet to
> remove bundled catch.

[...]

> +(snippet
> + ;; Remove bundled catch since we provide our own.
> + '(delete-file "libfive/test/catch.hpp"

It would be good to try to avoid adding more phases or snippets that
return unspecified values.  I fixed every snippet in 'core-updates', but
I guess more passes will be needed as these errors continue to be
introduced.

  Mark



Re: 01/01: gnu: Add guile-curl.

2018-04-19 Thread Roel Janssen

Mark H Weaver  writes:

> Hi Roel,
>
> r...@gnu.org (Roel Janssen) writes:
>
>> roelj pushed a commit to branch master
>> in repository guix.
>>
>> commit 5e3010a2ac651397e0cb69239a7d7aa3c0a5703e
>> Author: Roel Janssen 
>> Date:   Wed Apr 18 23:00:41 2018 +0200
>>
>> gnu: Add guile-curl.
>> 
>> * gnu/packages/curl.scm (guile-curl): New variable.
>
> [...]
>
>> +  (modify-phases %standard-phases
>> +(add-after 'install 'patch-extension-path
>> +  (lambda* (#:key outputs #:allow-other-keys)
>> + (let* ((out  (assoc-ref outputs "out"))
>> +(curl.scm (string-append
>> +   out "/share/guile/site/2.2/curl.scm"))
>> +(curl.go  (string-append
>> +   out "/lib/guile/2.2/site-ccache/curl.go"))
>> +(ext  (string-append out "/lib/guile/2.2/"
>> + "extensions/libguile-curl")))
>> +   (substitute* curl.scm (("libguile-curl") ext))
>> +   ;; The build system does not actually compile the Scheme 
>> module.
>> +   ;; So we can compile it and put it in the right place in one 
>> go.
>> +   (system* "guild" "compile" curl.scm "-o" curl.go))
>> +   #t)
>
> Please use 'invoke' instead of 'system*' from now on, so that errors in
> the subprocess will be detected and reported using exceptions.  As you
> have it now, compile failures will be ignored.

Whoops.  I will try to clear my brain's internal cache.
Thanks for letting me know.

>
> Would you like to push a fix?

I pushed a fix in d28e5ad23.

Kind regards,
Roel Janssen



Re: 01/01: gnu: Add guile-curl.

2018-04-19 Thread Mark H Weaver
Hi Roel,

r...@gnu.org (Roel Janssen) writes:

> roelj pushed a commit to branch master
> in repository guix.
>
> commit 5e3010a2ac651397e0cb69239a7d7aa3c0a5703e
> Author: Roel Janssen 
> Date:   Wed Apr 18 23:00:41 2018 +0200
>
> gnu: Add guile-curl.
> 
> * gnu/packages/curl.scm (guile-curl): New variable.

[...]

> +  (modify-phases %standard-phases
> +(add-after 'install 'patch-extension-path
> +  (lambda* (#:key outputs #:allow-other-keys)
> + (let* ((out  (assoc-ref outputs "out"))
> +(curl.scm (string-append
> +   out "/share/guile/site/2.2/curl.scm"))
> +(curl.go  (string-append
> +   out "/lib/guile/2.2/site-ccache/curl.go"))
> +(ext  (string-append out "/lib/guile/2.2/"
> + "extensions/libguile-curl")))
> +   (substitute* curl.scm (("libguile-curl") ext))
> +   ;; The build system does not actually compile the Scheme 
> module.
> +   ;; So we can compile it and put it in the right place in one 
> go.
> +   (system* "guild" "compile" curl.scm "-o" curl.go))
> +   #t)

Please use 'invoke' instead of 'system*' from now on, so that errors in
the subprocess will be detected and reported using exceptions.  As you
have it now, compile failures will be ignored.

Would you like to push a fix?

 Mark



Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Ludovic Courtès
Roel Janssen  skribis:

> Ludovic Courtès  writes:

[...]

>>> diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
>>> index deb7003d7..65770ba95 100644
>>> --- a/nix/nix-daemon/nix-daemon.cc
>>> +++ b/nix/nix-daemon/nix-daemon.cc
>>> @@ -529,6 +529,11 @@ static void performOp(bool trusted, unsigned int 
>>> clientVersion,
>>>  }
>>>  
>>>  case wopCollectGarbage: {
>>> +if (settings.isRemoteConnection) {
>>> +throw Error("Garbage collection is disabled for remote 
>>> hosts.");
>>> +break;
>>> +}
>>>  GCOptions options;
>>>  options.action = (GCOptions::GCAction) readInt(from);
>>>  options.pathsToDelete = readStorePaths(from);
>>
>> I was wondering if we would like to allow some of the ‘GCAction’ values,
>> but maybe it’s better to disallow them altogether like this code does.
>
> Could we please start with a “disable any GC” and start allowing cases
> on a case-by-case basis?

Sure, that’s what I was suggesting.  :-)

>> Last thing: could you add a couple of tests?  tests/guix-daemon.sh
>> already has tests for ‘--listen’, so you could take inspiration from
>> those.
>
> I included a test, but I don't know how I can properly run this test.
> Could you elaborate on how I can test the test(s)?

Run:

  make check TESTS=tests/guix-daemon.sh

See
.

> From b29d3a90e1487ebda5ac5b6bc146f8c95218eab6 Mon Sep 17 00:00:00 2001
> From: Roel Janssen 
> Date: Thu, 19 Apr 2018 14:01:49 +0200
> Subject: [PATCH] guix-daemon: Disable garbage collection for remote hosts.
>
> * nix/nix-daemon/nix-daemon.cc (performOp): Display appropriate error message;
>   (acceptConnection): Set isRemoteConnection when connection is over TCP.

Rather:

* nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable.
(performOp): For wopCollectGarbage, throw an error when
isRemoteConnection is set.
(acceptConnection): Set isRemoteConnection when connection is not AF_UNIX.

> +output=`GUIX_DAEMON_SOCKET="$socket" guix gc`
> +if [[ "$output" != *"GUIX_DAEMON_SOCKET=$socket" ]];
> +then
> +exit 1
> +fi

Perhaps simply check the exit code of ‘guix gc’ and fail if it succeeds?

Like:

  if guix gc; then false; else true; fi

Also please try to avoid Bash-specific constructs like [[ this ]].

Could you send an updated patch?

Thank you,
Ludo’.



Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Roel Janssen

Ludovic Courtès  writes:

> Roel Janssen  skribis:
>
>> Ludovic Courtès  writes:
>
> [...]
>
 diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
 index deb7003d7..65770ba95 100644
 --- a/nix/nix-daemon/nix-daemon.cc
 +++ b/nix/nix-daemon/nix-daemon.cc
 @@ -529,6 +529,11 @@ static void performOp(bool trusted, unsigned int 
 clientVersion,
  }
  
  case wopCollectGarbage: {
 +if (settings.isRemoteConnection) {
 +throw Error("Garbage collection is disabled for remote 
 hosts.");
 +break;
 +}
  GCOptions options;
  options.action = (GCOptions::GCAction) readInt(from);
  options.pathsToDelete = readStorePaths(from);
>>>
>>> I was wondering if we would like to allow some of the ‘GCAction’ values,
>>> but maybe it’s better to disallow them altogether like this code does.
>>
>> Could we please start with a “disable any GC” and start allowing cases
>> on a case-by-case basis?
>
> Sure, that’s what I was suggesting.  :-)
>
>>> Last thing: could you add a couple of tests?  tests/guix-daemon.sh
>>> already has tests for ‘--listen’, so you could take inspiration from
>>> those.
>>
>> I included a test, but I don't know how I can properly run this test.
>> Could you elaborate on how I can test the test(s)?
>
> Run:
>
>   make check TESTS=tests/guix-daemon.sh
>
> See
> .

That is really nice.  Thanks for pointing to the manual.

>> From b29d3a90e1487ebda5ac5b6bc146f8c95218eab6 Mon Sep 17 00:00:00 2001
>> From: Roel Janssen 
>> Date: Thu, 19 Apr 2018 14:01:49 +0200
>> Subject: [PATCH] guix-daemon: Disable garbage collection for remote hosts.
>>
>> * nix/nix-daemon/nix-daemon.cc (performOp): Display appropriate error 
>> message;
>>   (acceptConnection): Set isRemoteConnection when connection is over TCP.
>
> Rather:
>
> * nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable.
> (performOp): For wopCollectGarbage, throw an error when
> isRemoteConnection is set.
> (acceptConnection): Set isRemoteConnection when connection is not AF_UNIX.
>
>> +output=`GUIX_DAEMON_SOCKET="$socket" guix gc`
>> +if [[ "$output" != *"GUIX_DAEMON_SOCKET=$socket" ]];
>> +then
>> +exit 1
>> +fi
>
> Perhaps simply check the exit code of ‘guix gc’ and fail if it succeeds?

Right.

> Like:
>
>   if guix gc; then false; else true; fi
>
> Also please try to avoid Bash-specific constructs like [[ this ]].

Right.

> Could you send an updated patch?

The attached patch should be fine.

Kind regards,
Roel Janssen

>From fcbe7ebb3d205cf7310700e62b78b9aafd94f76f Mon Sep 17 00:00:00 2001
From: Roel Janssen 
Date: Thu, 19 Apr 2018 17:11:30 +0200
Subject: [PATCH] guix-daemon: Disable garbage collection for remote
 connections.

* nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable.
  (performOp): For wopCollectGarbage, throw an error when isRemoteConnection
  is set.
  (acceptConnection): Set isRemoteConnection when connection is not AF_UNIX.
* tests/guix-daemon.sh: Add a test for the new behavior.
---
 nix/nix-daemon/nix-daemon.cc | 10 +-
 tests/guix-daemon.sh | 14 ++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index deb7003d7..782e4acfc 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -54,7 +54,9 @@ static FdSink to(STDOUT_FILENO);
 
 bool canSendStderr;
 
-
+/* This variable is used to keep track of whether a connection
+   comes from a host other than the host running guix-daemon. */
+static bool isRemoteConnection;
 
 /* This function is called anytime we want to write something to
stderr.  If we're in a state where the protocol allows it (i.e.,
@@ -529,6 +531,11 @@ static void performOp(bool trusted, unsigned int clientVersion,
 }
 
 case wopCollectGarbage: {
+if (isRemoteConnection) {
+throw Error("Garbage collection is disabled for remote hosts.");
+break;
+}
+
 GCOptions options;
 options.action = (GCOptions::GCAction) readInt(from);
 options.pathsToDelete = readStorePaths(from);
@@ -934,6 +941,7 @@ static void acceptConnection(int fdSocket)
connection.  Setting these to -1 means: do not change.  */
 settings.clientUid = clientUid;
 		settings.clientGid = clientGid;
+isRemoteConnection = (remoteAddr.ss_family != AF_UNIX);
 
 /* Handle the connection. */
 from.fd = remote;
diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh
index 6f91eb58b..9ae6e0b77 100644
--- a/tests/guix-daemon.sh
+++ b/tests/guix-daemon.sh
@@ -194,6 +194,20 @@ do
 kill "$daemon_pid"
 done
 
+# Make sure garbage collection from a TCP connection does not work.
+
+tcp_socket="127.0.0.1:"
+guix-daemon --listen="$tc

Re: 03/07: gnu: libfive: Add snippet, enable tests and remove obsolete phase.

2018-04-19 Thread Ludovic Courtès
Hi Mark,

Mark H Weaver  skribis:

> l...@gnu.org (Ludovic Courtès) writes:
>
>> civodul pushed a commit to branch master
>> in repository guix.
>>
>> commit 0818c01aefbaa7ecce5e310ec5f70886850a7f9c
>> Author: Diego Nicola Barbato 
>> Date:   Fri Apr 6 13:43:54 2018 +0200
>>
>> gnu: libfive: Add snippet, enable tests and remove obsolete phase.
>> 
>> * gnu/packages/engineering.scm (libfive)[source]: Add snippet to
>> remove bundled catch.
>
> [...]
>
>> +(snippet
>> + ;; Remove bundled catch since we provide our own.
>> + '(delete-file "libfive/test/catch.hpp"
>
> It would be good to try to avoid adding more phases or snippets that
> return unspecified values.  I fixed every snippet in 'core-updates', but
> I guess more passes will be needed as these errors continue to be
> introduced.

Right, apologies for that; I’ve fixed this particular instance.

I look forward to the day where we can ignore those return values and
assume an exception is thrown when something goes wrong.  Thankfully the
work you’ve been doing on ‘core-updates’ should help us get there!

Ludo’.



Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Marius Bakke
Roel Janssen  writes:

> I included a test, but I don't know how I can properly run this test.
> Could you elaborate on how I can test the test(s)?

[...]

> diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh
> index 6f91eb58b..438c79c26 100644
> --- a/tests/guix-daemon.sh
> +++ b/tests/guix-daemon.sh
> @@ -194,6 +194,20 @@ do
>  kill "$daemon_pid"
>  done
>  
> +# Make sure garbage collection from a TCP connection does not work.
> +
> +socket="127.0.0.1:"
> +guix-daemon --listen="$socket" &
> +daemon_pid=$!
> +
> +output=`GUIX_DAEMON_SOCKET="$socket" guix gc`
> +if [[ "$output" != *"GUIX_DAEMON_SOCKET=$socket" ]];
> +then
> +exit 1
> +fi
> +
> +kill "$daemon_pid"
> +
>  # Log compression.
>  
>  guix-daemon --listen="$socket" --disable-chroot --debug 
> --log-compression=gzip &

Use `make check "TESTS=tests/guix-daemon.sh"` to only run this one test.


signature.asc
Description: PGP signature


Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Ludovic Courtès
Heya,

Roel Janssen  skribis:

> From fcbe7ebb3d205cf7310700e62b78b9aafd94f76f Mon Sep 17 00:00:00 2001
> From: Roel Janssen 
> Date: Thu, 19 Apr 2018 17:11:30 +0200
> Subject: [PATCH] guix-daemon: Disable garbage collection for remote
>  connections.
>
> * nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable.
>   (performOp): For wopCollectGarbage, throw an error when isRemoteConnection
>   is set.
>   (acceptConnection): Set isRemoteConnection when connection is not AF_UNIX.
> * tests/guix-daemon.sh: Add a test for the new behavior.

LGTM, thanks for the quick reply!

Ludo’.



Re: Guix-based build tool

2018-04-19 Thread Catonano
2018-04-18 23:09 GMT+02:00 Ludovic Courtès :

> Hello,
>
> Christopher Lemmer Webber  skribis:
>
> > While this is a fun idea, I'd still much rather have a guile-based
> > DSL replacement for autotools type things that's standalone (but maybe
> > also which can export to shell if need be).
>
> Yeah, not depending on Guix would have pros (it’d be more widely
> applicable), and cons (limited world view).
>
> Food for thought!
>
> Ludo’.
>
>
there' s this file guix/buid/emacs-utils.scm

it contains utilities to let Emacs byte-compile elisp files

So that' s an Emacs build system and it' s embedded in Guix

My initial idea was to do something similar with Guile

But then I tought that it could have been a stand alone package

Today in the morning I could manage to take a look at this issue

I made a script that visits the file system tree of a project and compiles
the .scm files

Here' s a short demo
https://www.youtube.com/watch?v=LaypeR8uw3Q

It doesn' t check the availability of dependencies (other guile packages)
yet

I was not sure how to achieve that

I saw that Automake generates snippets of bash scripting that try to run
guile with an expression loading the required module and if that fails then
the module is not available

The same functionality could be reproduced in Guile

I also saw the guildhall files that Ludo mentioned

So the thing is that the interface towards the user should be like those
guildhall files

and the interface towards the system should be like the Automake one

But, like Automake, it should only check if a Guile module is reachable on
the guile load path

If it' s not it shouldn't try manouvres: no sat solving, no fetching,
nothing.

A dependency could be there because you installed it with apt-get or with
dnf or because you used configure make on a manually downloaded guile
package

Or because you installed it with Guix or Nix

If it' s there, fine. if it' s not, that' s bad, the package can' t be built

What I mean is that this should be a build system, not a package management
system

This should address the concern that has been raised

Does it ?

I'll publish this soon, reviews and contributions appreciated ☺


Re: [PATCH] guix-daemon: Add option to disable garbage collection.

2018-04-19 Thread Roel Janssen

Ludovic Courtès  writes:

> Heya,
>
> Roel Janssen  skribis:
>
>> From fcbe7ebb3d205cf7310700e62b78b9aafd94f76f Mon Sep 17 00:00:00 2001
>> From: Roel Janssen 
>> Date: Thu, 19 Apr 2018 17:11:30 +0200
>> Subject: [PATCH] guix-daemon: Disable garbage collection for remote
>>  connections.
>>
>> * nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable.
>>   (performOp): For wopCollectGarbage, throw an error when isRemoteConnection
>>   is set.
>>   (acceptConnection): Set isRemoteConnection when connection is not AF_UNIX.
>> * tests/guix-daemon.sh: Add a test for the new behavior.
>
> LGTM, thanks for the quick reply!

Awesome.  Pushed in 5cefb13dd.

Thanks!

Kind regards,
Roel Janssen




Translating the manual

2018-04-19 Thread Julien Lepiller
Hi Guix!

I've just pushed three patches to help us translate the manual!

For developpers, nothing has changed, you can commit changes to the
English manual without worrying about other languages.

For translators, we must still put the .pot files on the TP before you
can send translations there. Of course, in the you can also start a
translation by using the .pot files present in the guix repository
(po/doc/guix.pot and po/doc/contributing.pot).

For maintainers, pot files can be updated by running "make
doc-pot-update" from the top directory of the guix repository.

As an example, I've also added a French translation for the manual, with
a complete translation of the first two pages (introduction) and the
contributing section.



Re: create a symlink

2018-04-19 Thread Joshua Branson

I guess I'm a little behind.  What's this install-hurd procedure?  Is
this getting the hurd running in a vm on a guixSD system?

Danny Milosavljevic  writes:

> Hi Rene,
>
>> But Guix waits for a string, is it possible to use a package to do the 
>> symlink?
>
> Not directly - but you can "convert" a package to a string by putting in 
> guix/scripts/system.scm :
>
>   (install-hurd #$hurd)
>
> or so (where "install-hurd" is your procedure in gnu/build/install.scm).



Re: Guix-based build tool

2018-04-19 Thread Catonano
2018-04-19 18:49 GMT+02:00 Catonano :

>
>
> 2018-04-18 23:09 GMT+02:00 Ludovic Courtès :
>
>> Hello,
>>
>> Christopher Lemmer Webber  skribis:
>>
>> > While this is a fun idea, I'd still much rather have a guile-based
>> > DSL replacement for autotools type things that's standalone (but maybe
>> > also which can export to shell if need be).
>>
>> Yeah, not depending on Guix would have pros (it’d be more widely
>> applicable), and cons (limited world view).
>>
>> Food for thought!
>>
>> Ludo’.
>>
>>
> there' s this file guix/buid/emacs-utils.scm
>
> it contains utilities to let Emacs byte-compile elisp files
>
> So that' s an Emacs build system and it' s embedded in Guix
>
> My initial idea was to do something similar with Guile
>
> But then I tought that it could have been a stand alone package
>
> Today in the morning I could manage to take a look at this issue
>
> I made a script that visits the file system tree of a project and compiles
> the .scm files
>
> Here' s a short demo
> https://www.youtube.com/watch?v=LaypeR8uw3Q
>
> It doesn' t check the availability of dependencies (other guile packages)
> yet
>
> I was not sure how to achieve that
>
> I saw that Automake generates snippets of bash scripting that try to run
> guile with an expression loading the required module and if that fails then
> the module is not available
>
> The same functionality could be reproduced in Guile
>
> I also saw the guildhall files that Ludo mentioned
>
> So the thing is that the interface towards the user should be like those
> guildhall files
>
> and the interface towards the system should be like the Automake one
>
> But, like Automake, it should only check if a Guile module is reachable on
> the guile load path
>


I am experimenting with this line

(system* "guile" "-c" "(use-modules (commonmark)) (exit ((lambda () 0)))")

If it finds the module it returns 0

Otherwise it returns a different number

I copied some bits for a configure script for a Guile project instrumented
with the Autotools

I could use an example of usage of "status:Exit-val"

The Guile manual says:

 Return the exit status value, as would be set if a process ended
 normally through a call to ‘exit’ or ‘_exit’, if any, otherwise
 ‘#f’.

this is not enouhg for me to understand

In which scenario is thhis function supposed to be used ? In order to do
what ?
An example would be of great help

Anyway: Is this the idiomatic way ?

Or maybe I should use some try catch form wrapping some module loading
instruction ?
Without launching a different guile process ?

Thanks for any hint


Re: Guix-based build tool

2018-04-19 Thread Catonano
2018-04-20 8:52 GMT+02:00 Catonano :

> 2018-04-19 18:49 GMT+02:00 Catonano :
>
>>
>>
>> 2018-04-18 23:09 GMT+02:00 Ludovic Courtès :
>>
>>> Hello,
>>>
>>> Christopher Lemmer Webber  skribis:
>>>
>>> > While this is a fun idea, I'd still much rather have a guile-based
>>> > DSL replacement for autotools type things that's standalone (but maybe
>>> > also which can export to shell if need be).
>>>
>>> Yeah, not depending on Guix would have pros (it’d be more widely
>>> applicable), and cons (limited world view).
>>>
>>> Food for thought!
>>>
>>> Ludo’.
>>>
>>>
>> there' s this file guix/buid/emacs-utils.scm
>>
>> it contains utilities to let Emacs byte-compile elisp files
>>
>> So that' s an Emacs build system and it' s embedded in Guix
>>
>> My initial idea was to do something similar with Guile
>>
>> But then I tought that it could have been a stand alone package
>>
>> Today in the morning I could manage to take a look at this issue
>>
>> I made a script that visits the file system tree of a project and
>> compiles the .scm files
>>
>> Here' s a short demo
>> https://www.youtube.com/watch?v=LaypeR8uw3Q
>>
>> It doesn' t check the availability of dependencies (other guile packages)
>> yet
>>
>> I was not sure how to achieve that
>>
>> I saw that Automake generates snippets of bash scripting that try to run
>> guile with an expression loading the required module and if that fails then
>> the module is not available
>>
>> The same functionality could be reproduced in Guile
>>
>> I also saw the guildhall files that Ludo mentioned
>>
>> So the thing is that the interface towards the user should be like those
>> guildhall files
>>
>> and the interface towards the system should be like the Automake one
>>
>> But, like Automake, it should only check if a Guile module is reachable
>> on the guile load path
>>
>
>
> I am experimenting with this line
>
> (system* "guile" "-c" "(use-modules (commonmark)) (exit ((lambda () 0)))")
>
> If it finds the module it returns 0
>
> Otherwise it returns a different number
>
> I copied some bits for a configure script for a Guile project instrumented
> with the Autotools
>
> I could use an example of usage of "status:Exit-val"
>
> The Guile manual says:
>
>  Return the exit status value, as would be set if a process ended
>  normally through a call to ‘exit’ or ‘_exit’, if any, otherwise
>  ‘#f’.
>
> this is not enouhg for me to understand
>
> In which scenario is thhis function supposed to be used ? In order to do
> what ?
> An example would be of great help
>
> Anyway: Is this the idiomatic way ?
>
> Or maybe I should use some try catch form wrapping some module loading
> instruction ?
> Without launching a different guile process ?
>
> Thanks for any hint
>


so

this line (notice the module is named commonmarL)

(system* "guile" "-c" "(use-modules (commonmarl)) (exit ((lambda () 0)))")

returns 256

while this one

(status:exit-val (system* "guile" "-c" "(use-modules (commonmarl)) (exit
((lambda () 0)))"))

returns 1

what's the point ?