Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1241382 > unrolled thread

Bug#346447: gopher: FTBFS on hurd

Started byJoão Pedro Malhado <phlogiston@sapo.pt>
First post2025-04-10 22:40 +0200
Last post2025-04-24 16:40 +0200
Articles 8 — 2 participants

Back to article view | Back to linux.debian.bugs.dist

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Bug#346447: gopher: FTBFS on hurd João Pedro Malhado <phlogiston@sapo.pt> - 2025-04-10 22:40 +0200
    Bug#346447: gopher: FTBFS on hurd John Goerzen <jgoerzen@complete.org> - 2025-04-11 05:30 +0200
      Bug#346447: gopher: FTBFS on hurd João Pedro Malhado <phlogiston@sapo.pt> - 2025-04-16 14:10 +0200
        Bug#346447: gopher: FTBFS on hurd John Goerzen <jgoerzen@complete.org> - 2025-04-16 14:50 +0200
          Bug#346447: gopher: FTBFS on hurd João Pedro Malhado <phlogiston@sapo.pt> - 2025-04-16 15:20 +0200
            Bug#346447: gopher: FTBFS on hurd John Goerzen <jgoerzen@complete.org> - 2025-04-20 06:30 +0200
              Bug#346447: gopher: FTBFS on hurd João Pedro Malhado <phlogiston@sapo.pt> - 2025-04-20 23:40 +0200
              Bug#346447: gopher: FTBFS on hurd João Pedro Malhado <phlogiston@sapo.pt> - 2025-04-24 16:40 +0200

#1241382 — Bug#346447: gopher: FTBFS on hurd

FromJoão Pedro Malhado <phlogiston@sapo.pt>
Date2025-04-10 22:40 +0200
SubjectBug#346447: gopher: FTBFS on hurd
Message-ID<KA6QN-cAJp-3@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

X-Debbugs-Cc: debian-hurd@lists.debian.org

Dear Maintainer,

Would you consider the attached patch aiming to address the long standing FTBS
on the Hurd, and allow Hurd users to explore gopher space?

Best regards,
João

[toc] | [next] | [standalone]


#1241409

FromJohn Goerzen <jgoerzen@complete.org>
Date2025-04-11 05:30 +0200
Message-ID<KAdfz-cEQC-5@gated-at.bofh.it>
In reply to#1241382
Hi João,

Thank you for sending this patch!  I don't believe it's correct,
however.

On line 202, curcwd is malloced.  Overwriting it prevents freeing it
later, so this creates a memory leak.

I suspect the later instance also has that issue.

How exactly is getcwd() defined and used on Hurd?

Thanks,

John

On Thu, Apr 10 2025, João Pedro Malhado wrote:

> X-Debbugs-Cc: debian-hurd@lists.debian.org
>
> Dear Maintainer,
>
> Would you consider the attached patch aiming to address the long standing FTBS
> on the Hurd, and allow Hurd users to explore gopher space?
>
> Best regards,
> João
>
> [2. text/x-diff; gopher-3.0.17.4-hurd.patch]...

[toc] | [prev] | [next] | [standalone]


#1242268

FromJoão Pedro Malhado <phlogiston@sapo.pt>
Date2025-04-16 14:10 +0200
Message-ID<KC9Kx-dWb4-3@gated-at.bofh.it>
In reply to#1241409
Hello John,

Thank you for having a look at the patch.
I apologise as the patch is indeed a bit rushed.

On Thu, Apr 10, 2025 at 10:15:02PM -0500, John Goerzen wrote:
> Thank you for sending this patch!  I don't believe it's correct,
> however.
> 
> On line 202, curcwd is malloced.  Overwriting it prevents freeing it
> later, so this creates a memory leak.
> 
> I suspect the later instance also has that issue.

I see what you mean. Instead of allocating the memory on line 202, would it not
be possible to dynamically allocate with getcwd(NULL, 0) when that function is
available?
Is there any case that would not be covered by this?


> How exactly is getcwd() defined and used on Hurd?

My understanding is that on Hurd getcwd() is just defined in glibc. Looking at
the comment in
https://sources.debian.org/src/glibc/2.41-7/io/getcwd.c/?hl=39#L25

Many thanks,
João

[toc] | [prev] | [next] | [standalone]


#1242302

FromJohn Goerzen <jgoerzen@complete.org>
Date2025-04-16 14:50 +0200
Message-ID<KCanf-dWrf-7@gated-at.bofh.it>
In reply to#1242268
On Wed, Apr 16 2025, João Pedro Malhado wrote:

> Hello John,
>
> Thank you for having a look at the patch.
> I apologise as the patch is indeed a bit rushed.
>
> On Thu, Apr 10, 2025 at 10:15:02PM -0500, John Goerzen wrote:
>> Thank you for sending this patch!  I don't believe it's correct,
>> however.
>> 
>> On line 202, curcwd is malloced.  Overwriting it prevents freeing it
>> later, so this creates a memory leak.
>> 
>> I suspect the later instance also has that issue.
>
> I see what you mean. Instead of allocating the memory on line 202, would it not
> be possible to dynamically allocate with getcwd(NULL, 0) when that function is
> available?
> Is there any case that would not be covered by this?

I think that would work fine on Linux and Hurd.  That behavior, however,
isn't POSIX so wouldn't be portable.  Can you clarify what the problem
with getcwd() as written is on Hurd?  From the description in glibc, it
sounds like the behavior is the same as on Linux.

- John


>
>
>> How exactly is getcwd() defined and used on Hurd?
>
> My understanding is that on Hurd getcwd() is just defined in glibc. Looking at
> the comment in
> https://sources.debian.org/src/glibc/2.41-7/io/getcwd.c/?hl=39#L25
>
> Many thanks,
> João

[toc] | [prev] | [next] | [standalone]


#1242307

FromJoão Pedro Malhado <phlogiston@sapo.pt>
Date2025-04-16 15:20 +0200
Message-ID<KCaQh-dWRo-1@gated-at.bofh.it>
In reply to#1242302
Hello John,

On Wed, Apr 16, 2025 at 07:32:22AM -0500, John Goerzen wrote:
> I think that would work fine on Linux and Hurd.  That behavior, however,
> isn't POSIX so wouldn't be portable.  Can you clarify what the problem
> with getcwd() as written is on Hurd?  From the description in glibc, it
> sounds like the behavior is the same as on Linux.

The issue is that MAXPATHLEN is not defined on Hurd. For reference:
https://darnassus.sceen.net/~hurd-web/faq/foo_max/

It is interesting that you mention POSIX compliance, as I have seen
contradictory information about this. The above linked page states that
getcwd(NULL, 0) is part of POSIX 2008.

Best regards,
João

[toc] | [prev] | [next] | [standalone]


#1242803

FromJohn Goerzen <jgoerzen@complete.org>
Date2025-04-20 06:30 +0200
Message-ID<KDutA-eSky-1@gated-at.bofh.it>
In reply to#1242307
On Wed, Apr 16 2025, João Pedro Malhado wrote:

> Hello John,
>
> On Wed, Apr 16, 2025 at 07:32:22AM -0500, John Goerzen wrote:
>> I think that would work fine on Linux and Hurd.  That behavior, however,
>> isn't POSIX so wouldn't be portable.  Can you clarify what the problem
>> with getcwd() as written is on Hurd?  From the description in glibc, it
>> sounds like the behavior is the same as on Linux.
>
> The issue is that MAXPATHLEN is not defined on Hurd. For reference:
> https://darnassus.sceen.net/~hurd-web/faq/foo_max/
>
> It is interesting that you mention POSIX compliance, as I have seen
> contradictory information about this. The above linked page states that
> getcwd(NULL, 0) is part of POSIX 2008.

Hi,

Every reference I have seen says it's not part of POSIX.  However, Linux
and the BSDs seem to support it, so might as well just assume it will
work.  If you have a patch to just go that direction, I'll take it.

- John

[toc] | [prev] | [next] | [standalone]


#1242895

FromJoão Pedro Malhado <phlogiston@sapo.pt>
Date2025-04-20 23:40 +0200
Message-ID<KDKyl-f2uA-5@gated-at.bofh.it>
In reply to#1242803
Hello John,

On Sat, Apr 19, 2025 at 11:20:11PM -0500, John Goerzen wrote:
> Every reference I have seen says it's not part of POSIX.  However, Linux
> and the BSDs seem to support it, so might as well just assume it will
> work.  If you have a patch to just go that direction, I'll take it.

Ok, I can send a patch. However I am puzzled by the current code and wanted to
ask you.

Is there not a problem in the case
#if !defined(HAVE_GETCWD) && !defined(HAVE_GET_CURRENT_DIR_NAME)
where getwd(curcwd) would be used but curcwd has not been allocated?

And in the case
#if !defined(HAVE_GETCWD) && defined(HAVE_GET_CURRENT_DIR_NAME)
and get_current_dir_name() is used, but the free(curcwd) is not called
in line 347.
Is this not a memory leak?

Best regards,
João

[toc] | [prev] | [next] | [standalone]


#1243452

FromJoão Pedro Malhado <phlogiston@sapo.pt>
Date2025-04-24 16:40 +0200
Message-ID<KF5U5-fTCb-5@gated-at.bofh.it>
In reply to#1242803

[Multipart message — attachments visible in raw view] — view raw

X-Debbugs-Cc: debian-hurd@lists.debian.org

Hello John,

On Sat, Apr 19, 2025 at 11:20:11PM -0500, John Goerzen wrote:
> Every reference I have seen says it's not part of POSIX.  However, Linux
> and the BSDs seem to support it, so might as well just assume it will
> work.  If you have a patch to just go that direction, I'll take it.

Please see attached my second attempt at patching gopher.

Best regards,
João

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web