#17 Hurd support
Closed: Fixed None Opened 8 years ago by tfheen.

It seems like mlocate uses PATH_MAX, which isn't defined on the hurd. Attached you'll find a patch that fixes this.

This is also Debian bug #610209, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=610209


Thanks for the patch.

mlocate is trying hard to be portable:

  • Per POSIX, the path passed to pathconf (_PC_PATH_MAX, ...) needs to be a directory. In fact, given how size is used, replacing PATH_MAX by BUFSIZ should be good enough and is much simpler than the #ifdef.
  • realpath (..., NULL) is defined only in the very latest POSIX version. I'd be more comfortable with canonicalize_file_name () from gnulib, which is already being imported.
  • ?: is not portable - if ()...else... would be preferred.

Could you send an updated patch that was tested on Hurd, please?

Attaching a new patch for GNU/Hurd. The patched mlocate has been running on GNU/Linux amd64 and on GNU/Hurd for a week now. No problems so far.

Thanks for the patch. canonicalize_file_name is already provided to mlocate by gnulib, and the resulting path needs to be freed.

Please test the attached patch on Hurd and tell me whether it works fine.

I will test your patch and will report soon. Thanks!

There are two instances of buf that need to be changed from readline to
canonicalize_file_name. The second one is in function rebuild_bind_mount_paths:

--- updatedb.c.patched 2011-12-10 18:17:16.000000000 +0100
+++ updatedb.c.new 2011-12-11 10:44:14.000000000 +0100
@@ -379,9 +379,8 @@
if (hasmntopt (me, "bind") != NULL
&& strcmp (me->mnt_fsname, me->mnt_dir) != 0)
{
- char dbuf[PATH_MAX], dir;
-
- dir = realpath (me->mnt_dir, dbuf);
+ char
dir;
+ dir = canonicalize_file_name (me->mnt_dir);
if (dir == NULL)
dir = me->mnt_dir;
if (conf_debug_pruning != false)

And that one has to be freed too??

Sorry, the posting above was scrambled. I have attached a complete updated patch. It it OK with you?

Replying to [comment:6 svantes]:

Sorry, the posting above was scrambled. I have attached a complete updated patch. Is it OK with you?

Sorry, I forgot the first part of the patch: src/conf.c. Of course it has to be included too.

Thanks for testing. The patch was against the upstream development tree, which does not use PATH_MAX in rebuild_bind_mount_paths any more, I apologize for the confusion.

I have applied the "hurd.patch".

Replying to [comment:8 mitr]:

I have applied the "hurd.patch".

Released in mlocate-0.25; please reopen if this is insufficient.

Thanks again for the patches.

Metadata Update from @svantes:
- Issue assigned to mitr

2 years ago

Login to comment on this ticket.

Metadata