Skip to content

Update templateConfig.sh to not break with directorys with space on t… #10898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 4.19
Choose a base branch
from

Conversation

vits-hugs
Copy link
Contributor

Description

Currently the script of templateConfig.sh doesn't recognize folders with spaces in their names, which can cause compilation errors, this PR updates the script so that the folders with space in their names are recognized.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

To test this, I renamed my user folder to have a white-space in it, then ran the process of building the project, which runs the templateConfig.sh, and verified that there wasn't any errors on the building process.

METADATAFILE=${PARENTPATH}"metadata.ini"
echo > $METADATAFILE
METADATAFILE="${PARENTPATH}metadata.ini"
echo > "$METADATAFILE"
SOURCEFILE=${PARENTPATH}'md5sum.txt'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about line 81 and line 84 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should not have problems, since on line 80 it's certain that the PARENTPATH variable will be a String, so line 81 and 84 should always work properly even with spaces on the paths. If you find any test case that triggers an error please report to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vits-hugs
my testing result: no space in METADATAFILE

<08:21:05> weizhou:/tmp $ mkdir "aa bb"
<08:21:07> weizhou:/tmp $ cd aa\ bb/
<08:21:09> weizhou:/tmp/aa bb $ 
<08:21:09> weizhou:/tmp/aa bb $ 
<08:21:09> weizhou:/tmp/aa bb $ PARENTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/dist/systemvm-templates/"
<08:21:14> weizhou:/tmp/aa bb $ echo $PARENTPATH
/usr/bin/dist/systemvm-templates/
<08:21:26> weizhou:/tmp/aa bb $ METADATAFILE=${PARENTPATH}"metadata.ini"
<08:22:00> weizhou:/tmp/aa bb $ echo $METADATAFILE
/usr/bin/dist/systemvm-templates/metadata.ini

Copy link
Contributor Author

@vits-hugs vits-hugs May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, when i tested, i got the result below, which is the expected behaviour, i don't know how you got the "/usr/bin/..." path, since the command "pwd -P" should return your current working directory.

vitor@vitor-Inspiron-5480:/tmp$ mkdir "aa bb"
vitor@vitor-Inspiron-5480:/tmp$ cd aa\ bb/
vitor@vitor-Inspiron-5480:/tmp/aa bb$ PARENTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/dist/systemvm-templates/" 
vitor@vitor-Inspiron-5480:/tmp/aa bb$ echo $PARENTPATH 
/tmp/aa bb/dist/systemvm-templates/
vitor@vitor-Inspiron-5480:/tmp/aa bb$ METADATAFILE=${PARENTPATH}"metadata.ini"  
vitor@vitor-Inspiron-5480:/tmp/aa bb$ echo > "$METADATAFILE"  
bash: /tmp/aa bb/dist/systemvm-templates/metadata.ini: No such file or directory
vitor@vitor-Inspiron-5480:/tmp/aa bb$ 

Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 4.28%. Comparing base (f0838cd) to head (beeb8ff).
Report is 21 commits behind head on 4.19.

❗ There is a different number of reports uploaded between BASE (f0838cd) and HEAD (beeb8ff). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (f0838cd) HEAD (beeb8ff)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.19   #10898       +/-   ##
=============================================
- Coverage     15.17%    4.28%   -10.90%     
=============================================
  Files          5414      372     -5042     
  Lines        475185    29743   -445442     
  Branches      57991     5229    -52762     
=============================================
- Hits          72105     1274    -70831     
+ Misses       395018    28324   -366694     
+ Partials       8062      145     -7917     
Flag Coverage Δ
uitests 4.28% <ø> (-0.01%) ⬇️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants