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

Error-proof pattern-matching in xe-linux-distribution #102

Open
stormi opened this issue May 7, 2021 · 1 comment
Open

Error-proof pattern-matching in xe-linux-distribution #102

stormi opened this issue May 7, 2021 · 1 comment

Comments

@stormi
Copy link
Contributor

stormi commented May 7, 2021

The current implementation of xe-linux-distribution, based on sed, is rather fragile and often ends in that kind of error when the distro is unsupported:

[root@localhost Linux]# ./xe-linux-distribution 
sed: -e expression #1, char 103: invalid reference \2 on `s' command's RHS

We should implement the pattern matching in a more robust way while still portable of course.

I may give it a try sometime in the future...

@stormi
Copy link
Contributor Author

stormi commented May 7, 2021

Hmm, actually the error above probably only happens when it's trying an invalid pattern. The normal behaviour is to return nothing.

So it's less fragile than what I thought, but can easily be broken by future changes to the script. One just needs to add one invalid pattern somewhere, and this is not easily spotted during a PR review.

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

No branches or pull requests

1 participant