KWON BYUNGCHANG created BIGTOP-4545:
---------------------------------------

             Summary: hbase: versionless jar symlinks broken for version 
strings with extra "-<digit>" suffix
                 Key: BIGTOP-4545
                 URL: https://issues.apache.org/jira/browse/BIGTOP-4545
             Project: Bigtop
          Issue Type: Bug
            Reporter: KWON BYUNGCHANG


The hbase RPM creates versionless symlinks for jars using a sed pattern:

{code}
for i in `ls hbase*jar | grep -v tests.jar`
do
    ln -s $i `echo $i | sed -n 's/\(.*\)\(-[0-9].*\)\(.jar\)/\1\3/p'`
done
{code}

The greedy \(.*\) makes the pattern strip only from the *last* "-<digit>" 
occurrence. This breaks for version strings that contain an additional 
"-<digit>" segment, e.g. a downstream/vendor version like 2.6.5-custom-1:

{code}
$ echo hbase-common-2.6.5-custom-1.jar | sed -n 
's/\(.*\)\(-[0-9].*\)\(.jar\)/\1\3/p'
hbase-common-2.6.5-custom.jar
{code}

The expected link name is hbase-common.jar, but hbase-common-2.6.5-custom.jar 
is created instead.

Fix: match against the known HBASE_VERSION explicitly instead of guessing where 
the version starts:

{code}
for i in `ls hbase*jar | grep -v tests.jar`
do
   if [[ $i =~ hbase-(.*)-${HBASE_VERSION}.jar ]]; then
     name=${BASH_REMATCH[1]}
     ln -s $i hbase-$name.jar
   fi
done
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to