Skip to content
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

T6173: Fix build error when "--version" value contains "/" #543

Closed

Conversation

rts-kotori
Copy link

Change Summary

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

vyos-build-image script

Proposed changes

Instead of not checking for any / in the --version string, it now replaces / to _ so that the copy image step does not throw any error

How to test

I have ran the build script after applying the changes to the build script, and confirmed that it fixes the issue stated above.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team March 26, 2024 03:08
@sever-sever
Copy link
Member

Why do not use _ in the image version initially?

@rts-kotori
Copy link
Author

rts-kotori commented Mar 26, 2024

Why do not use _ in the image version initially?

I just discovered this bug accidentally and thought, why not fix it, since it is easy to fix.

@sever-sever
Copy link
Member

I'd probably add verify to the image name.

@rts-kotori
Copy link
Author

I don't seems to see any verify function in the build script or from any imports it is currently importing. What do you refer to by verify?

@c-po
Copy link
Member

c-po commented Apr 1, 2024

I don't seems to see any verify function in the build script or from any imports it is currently importing. What do you refer to by verify?

A verification function should be added.

for character in ['/', '~']:
    if character in version_data["version"]:
        exit(f'Version contains invalid character: {character}')

@dmbaturin
Copy link
Member

dmbaturin commented Apr 2, 2024

Maybe just use a regex to disallow anything except [0-9a-zA-Z\-\.\+]?

@rts-kotori
Copy link
Author

I don't seems to see any verify function in the build script or from any imports it is currently importing. What do you refer to by verify?

A verification function should be added.

for character in ['/', '~']:
    if character in version_data["version"]:
        exit(f'Version contains invalid character: {character}')

What characters should be allowed by --version? In my tests, ~ didn't cause an error, only / did

Maybe just use a regex to disallow anything except [0-9a-zA-Z\-\.\+]?

Why should other characters be blocked if it does not cause a build error?

@c-po
Copy link
Member

c-po commented Apr 4, 2024

Why should other characters be blocked if it does not cause a build error?

Regular software engineering paranoia on operating systems. ~ marks the Linux home. Is there any reason to have a ~ in the version file or anything other then in [0-9a-zA-Z\-\.\+]? I guess we should keep it as simple as possible.

@jestabro
Copy link
Contributor

jestabro commented Apr 4, 2024

@c-po
Copy link
Member

c-po commented Apr 8, 2024

@rts-kotori thank you for pointing this out. This is now superseeded by #553

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

Successfully merging this pull request may close these issues.

5 participants