You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by rh...@apache.org on 2016/01/28 10:47:00 UTC

svn commit: r1727295 - /serf/trunk/SConstruct

Author: rhuijben
Date: Thu Jan 28 09:47:00 2016
New Revision: 1727295

URL: http://svn.apache.org/viewvc?rev=1727295&view=rev
Log:
Avoid constructing a library name with variables without
proper escaping when SHLIBNAME is '$LIBNAME'

Found by: philip

* SConstruct
  Handle special case that should have been caught by scons.

Modified:
    serf/trunk/SConstruct

Modified: serf/trunk/SConstruct
URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1727295&r1=1727294&r2=1727295&view=diff
==============================================================================
--- serf/trunk/SConstruct (original)
+++ serf/trunk/SConstruct Thu Jan 28 09:47:00 2016
@@ -230,11 +230,15 @@ incdir = '$PREFIX/include/serf-$MAJOR'
 if sys.platform != 'sunos5':
   env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
 
-SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
-LIBNAME   = '%sserf-%s' % (env['LIBPREFIX'], MAJOR)
+LIBNAME   = '%sserf-%d' % (env['LIBPREFIX'], MAJOR)
 if sys.platform == 'win32':
   # On Win32 SHLIBPREFIX and LIBPREFIX are empty and both produce a .lib file.
   SHLIBNAME = 'libserf-%d' % (MAJOR, )
+elif env['SHLIBPREFIX'] == '$LIBPREFIX':
+  # Let's avoid constructing '$LIBPREFIXserf...' which evaluates to ''
+  SHLIBNAME = LIBNAME
+else:
+  SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
 
 env.Append(RPATH=[libdir],
            PDB='${TARGET.filebase}.pdb')



RE: svn commit: r1727295 - /serf/trunk/SConstruct

Posted by Bert Huijben <be...@qqmail.nl>.
If we would handle both cases as the else clause we construct the string ‘$LIBPREFIXserf-1’, as the evaluation rules of scons handles \$[a-zA-Z]+ as macro reference we just constructed an undefined environment variable before this patch, while we really just want an alias of LIBNAME, which is created in the same way but with a different prefix.

The problem was that we created A ‘lib-2.so’.


I think this comment is a summary of what I described above, but as noted in my other mail I’m interested in better solutions to this problem. I’m not an scons expert…

(Currently this specific block resolves the problem identified by Philip.)

Bert

Sent from Mail for Windows 10

From: Greg Stein
Sent: donderdag 28 januari 2016 13:25
To: Bert Huijben
Cc: dev@serf.apache.org
Subject: Re: svn commit: r1727295 - /serf/trunk/SConstruct

On Thu, Jan 28, 2016 at 3:47 AM, <rh...@apache.org> wrote:
>...

> +++ serf/trunk/SConstruct Thu Jan 28 09:47:00 2016
> @@ -230,11 +230,15 @@ incdir = '$PREFIX/include/serf-$MAJOR'
>  if sys.platform != 'sunos5':
>    env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
>
> -SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
> -LIBNAME   = '%sserf-%s' % (env['LIBPREFIX'], MAJOR)
> +LIBNAME   = '%sserf-%d' % (env['LIBPREFIX'], MAJOR)
>  if sys.platform == 'win32':
>    # On Win32 SHLIBPREFIX and LIBPREFIX are empty and both produce a .lib
> file.
>    SHLIBNAME = 'libserf-%d' % (MAJOR, )
> +elif env['SHLIBPREFIX'] == '$LIBPREFIX':
> +  # Let's avoid constructing '$LIBPREFIXserf...' which evaluates to ''
>

The above comment makes NO sense. How does it relate to the following line.
Or anything?


> +  SHLIBNAME = LIBNAME
> +else:
> +  SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
>
>  env.Append(RPATH=[libdir],
>             PDB='${TARGET.filebase}.pdb')
>
>
>


Re: svn commit: r1727295 - /serf/trunk/SConstruct

Posted by Greg Stein <gs...@gmail.com>.
On Thu, Jan 28, 2016 at 3:47 AM, <rh...@apache.org> wrote:
>...

> +++ serf/trunk/SConstruct Thu Jan 28 09:47:00 2016
> @@ -230,11 +230,15 @@ incdir = '$PREFIX/include/serf-$MAJOR'
>  if sys.platform != 'sunos5':
>    env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
>
> -SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
> -LIBNAME   = '%sserf-%s' % (env['LIBPREFIX'], MAJOR)
> +LIBNAME   = '%sserf-%d' % (env['LIBPREFIX'], MAJOR)
>  if sys.platform == 'win32':
>    # On Win32 SHLIBPREFIX and LIBPREFIX are empty and both produce a .lib
> file.
>    SHLIBNAME = 'libserf-%d' % (MAJOR, )
> +elif env['SHLIBPREFIX'] == '$LIBPREFIX':
> +  # Let's avoid constructing '$LIBPREFIXserf...' which evaluates to ''
>

The above comment makes NO sense. How does it relate to the following line.
Or anything?


> +  SHLIBNAME = LIBNAME
> +else:
> +  SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
>
>  env.Append(RPATH=[libdir],
>             PDB='${TARGET.filebase}.pdb')
>
>
>

Re: svn commit: r1727295 - /serf/trunk/SConstruct

Posted by Philip Martin <ph...@wandisco.com>.
"Bert Huijben" <be...@qqmail.nl> writes:

> But for now, I think this fixes the problem identified by Philip.

Yes, thanks!

-- 
Philip Martin
WANdisco

RE: svn commit: r1727295 - /serf/trunk/SConstruct

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: rhuijben@apache.org [mailto:rhuijben@apache.org]
> Sent: donderdag 28 januari 2016 10:47
> To: dev@serf.apache.org
> Subject: svn commit: r1727295 - /serf/trunk/SConstruct
> 
> Author: rhuijben
> Date: Thu Jan 28 09:47:00 2016
> New Revision: 1727295
> 
> URL: http://svn.apache.org/viewvc?rev=1727295&view=rev
> Log:
> Avoid constructing a library name with variables without
> proper escaping when SHLIBNAME is '$LIBNAME'
> 
> Found by: philip
> 
> * SConstruct
>   Handle special case that should have been caught by scons.
> 
> Modified:
>     serf/trunk/SConstruct
> 
> Modified: serf/trunk/SConstruct
> URL:
> http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1727295&r1=1727
> 294&r2=1727295&view=diff
> ==========================================================
> ====================
> --- serf/trunk/SConstruct (original)
> +++ serf/trunk/SConstruct Thu Jan 28 09:47:00 2016
> @@ -230,11 +230,15 @@ incdir = '$PREFIX/include/serf-$MAJOR'
>  if sys.platform != 'sunos5':
>    env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
> 
> -SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)
> -LIBNAME   = '%sserf-%s' % (env['LIBPREFIX'], MAJOR)
> +LIBNAME   = '%sserf-%d' % (env['LIBPREFIX'], MAJOR)
>  if sys.platform == 'win32':
>    # On Win32 SHLIBPREFIX and LIBPREFIX are empty and both produce a .lib
> file.
>    SHLIBNAME = 'libserf-%d' % (MAJOR, )
> +elif env['SHLIBPREFIX'] == '$LIBPREFIX':
> +  # Let's avoid constructing '$LIBPREFIXserf...' which evaluates to ''
> +  SHLIBNAME = LIBNAME
> +else:
> +  SHLIBNAME = '%sserf-%d' % (env['SHLIBPREFIX'], MAJOR)

A better fix might involve env.subst() or just adding the variable properly escaped ourselves, but I'm not entirely sure.

But for now, I think this fixes the problem identified by Philip.

	Bert