unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* readlink system calls
@ 2023-08-22 16:22 Christopher Baines
  2023-08-22 19:03 ` Olivier Dion
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Baines @ 2023-08-22 16:22 UTC (permalink / raw)
  To: Guile User

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

When looking at strace for various Guile things, I'm seeing a lot of
readlink system calls for directories in the load path, e.g.

readlink("/gnu", 0x7fff8738f430, 1023)  = -1 EINVAL (Invalid argument)
readlink("/gnu/store", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/lkx2k8hy40a6s3vz94287g8fr2sxs7h0-profile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/lkx2k8hy40a6s3vz94287g8fr2sxs7h0-profile/share", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/lkx2k8hy40a6s3vz94287g8fr2sxs7h0-profile/share/guile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/lkx2k8hy40a6s3vz94287g8fr2sxs7h0-profile/share/guile/site", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/lkx2k8hy40a6s3vz94287g8fr2sxs7h0-profile/share/guile/site/3.0", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu", 0x7fff8738f430, 1023)  = -1 EINVAL (Invalid argument)
readlink("/gnu/store", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile/3.0", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu", 0x7fff8738f430, 1023)  = -1 EINVAL (Invalid argument)
readlink("/gnu/store", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile/site", 0x7fff8738f430, 1023) = -1 ENOENT (No such file or directory)
readlink("/gnu", 0x7fff8738f430, 1023)  = -1 EINVAL (Invalid argument)
readlink("/gnu/store", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile/site", 0x7fff8738f430, 1023) = -1 ENOENT (No such file or directory)
readlink("/gnu", 0x7fff8738f430, 1023)  = -1 EINVAL (Invalid argument)
readlink("/gnu/store", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)
readlink("/gnu/store/2429gbw7plqmyb78h2yg67gaqwapv7gm-guile-next-3.0.9-0.aa2cfe7/share/guile", 0x7fff8738f430, 1023) = -1 EINVAL (Invalid argument)


Any idea what leads to this behaviour?

Thanks,

Chris

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

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

* Re: readlink system calls
  2023-08-22 16:22 readlink system calls Christopher Baines
@ 2023-08-22 19:03 ` Olivier Dion
  2023-08-24 15:40   ` Maxime Devos
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Dion @ 2023-08-22 19:03 UTC (permalink / raw)
  To: Christopher Baines, Guile User

On Tue, 22 Aug 2023, Christopher Baines <mail@cbaines.net> wrote:
> When looking at strace for various Guile things, I'm seeing a lot of
> readlink system calls for directories in the load path, e.g.

Is this not more a side effect of using Guix (the GNU store) than Guile
itself?

-- 
Olivier Dion
oldiob.dev



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

* Re: readlink system calls
  2023-08-22 19:03 ` Olivier Dion
@ 2023-08-24 15:40   ` Maxime Devos
  0 siblings, 0 replies; 3+ messages in thread
From: Maxime Devos @ 2023-08-24 15:40 UTC (permalink / raw)
  To: Olivier Dion, Christopher Baines, Guile User


[-- Attachment #1.1.1: Type: text/plain, Size: 1239 bytes --]



Op 22-08-2023 om 21:03 schreef Olivier Dion:
> On Tue, 22 Aug 2023, Christopher Baines <mail@cbaines.net> wrote:
>> When looking at strace for various Guile things, I'm seeing a lot of
>> readlink system calls for directories in the load path, e.g.
> 
> Is this not more a side effect of using Guix (the GNU store) than Guile
> itself?

I'm pretty sure that, store or not, there is probably not a good reason 
Guile is 'readlink'-ing the same directories multiple times.  Even if it 
were a side effect of using Guix, it appears to be something that needs 
to be addressed in Guile.

> Any idea what leads to this behaviour?

Hypothesis:

  * Guile is searching for .go/.scm files in the load paths
  * as part of that this process, it readlinks stuff
    (don't know why Guile would need this information though)
  * it doesn't cache any of this readlink information, so if
    you load N .go/.scm files from the same directory, then the
    number of readlink calls is multiplied by N.

Assuming this hypothesis true, a potential solution could be to cache 
the readlink information.  Whether that's a correct solution depends on 
what the purpose of these readlink calls are ...

Best regards,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

end of thread, other threads:[~2023-08-24 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-22 16:22 readlink system calls Christopher Baines
2023-08-22 19:03 ` Olivier Dion
2023-08-24 15:40   ` Maxime Devos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).