On Wed, Jul 17, 2024 at 2:35 PM Timofei Zhakov <t...@chemodax.net> wrote:

> On Wed, Jul 17, 2024 at 8:21 PM Nathan Hartman <hartman.nat...@gmail.com>
> wrote:
> >
> > On Wed, Jul 17, 2024 at 10:31 AM Timofei Zhakov <t...@chemodax.net>
> wrote:
> > (snipping most content)
> > > When I was was doing that, I solved the problem with uname with a
> > > little patch by adding ifdef over release_name_from_uname() invocation
> > > in sysinfo.c:
> > >
> > > [[[
> > > Index: subversion/libsvn_subr/sysinfo.c
> > > ===================================================================
> > > --- subversion/libsvn_subr/sysinfo.c    (revision 1919186)
> > > +++ subversion/libsvn_subr/sysinfo.c    (working copy)
> > > @@ -646,8 +646,12 @@
> > >  static const char *
> > >  linux_release_name(apr_pool_t *pool)
> > >  {
> > > -  const char *uname_release = release_name_from_uname(pool);
> > > +  const char *uname_release;
> > >
> > > +#if HAVE_UNAME
> > > +  uname_release = release_name_from_uname(pool);
> > > +#endif
> > (snipping the rest...)
> >
> > If HAVE_UNAME is not defined, then uname_release will point to
> > undefined address? I think we need some default string. Perhaps
> > "unknown"?
>
> Hi,
>
> Yes it will. However, as I understand the implementation of
> release_name_from_uname(), it returns NULL if the uname cannot be
> recognized (see sysinfo.c:312).
>
> Additionally, the svn_sysinfo__release_name function (which will
> return that NULL) could do that, because (sysinfo.h:41):
>
> [[[
> Return the release name (i.e., marketing name) of the running
> system, or NULL if it's not available.
>
> All allocations are done in POOL.
> ]]]
>
> However, "unknown" might be better than NULL...
>
> --
> Timofei Zhakov



Actually I just looked at the code (I probably should have looked before my
"unknown" reply!!) and if uname_release is NULL then near the end of the
function we return release_name instead. If we assign "unknown" to
uname_release then we will mess up this logic.

Therefore IMO it would be a more correct fix to wrap most of the body
of release_name_from_uname()
in #if HAVE_UNAME so that that function will return NULL if uname() is not
available, then leave the call site function as is.

Cheers,
Nathan

Reply via email to