canonical / canonical/cloud-init
sed expression in tools/tox-venv is not POSIX compatible
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 22
Description
This bug was originally filed in Launchpad as [LP: #1853441](https://bugs.launchpad.net/cloud-init/+bug/1853441)
Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2019-11-21T11:05:46.579756+00:00
date_fix_committed = None
date_fix_released = None
id = 1853441
importance = low
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1853441
milestone = None
owner = minagalic
owner_name = Mina Galić
private = False
status = triaged
submitter = minagalic
submitter_name = Mina Galić
tags = ['freebsd']
duplicates = []
_Launchpad user **Mina Galić(minagalic)** wrote on 2019-11-21T11:05:46.579756+00:00_
When running tools/tox-venv py3 on FreeBSD, I get the following Error:
sed: 2: ":x; /\\$/ { N; s/\\\n[ ...": unused label 'x; /\\$/ { N; s/\\\n[ ]*//; tx };'
This suggests to me, that the expression
sed -e ':x; /\\$/ { N; s/\\\n[ ]*//; tx };' "${tox_ini}" |
is not POSIX compatible.
Looking at GNU sed's documentation, I see the first issue with making this expression POSIX compliant will be that `N` behaves intentionally different on GNU sed than on POSIX:
https://www.gnu.org/software/sed/manual/html_node/Reporting-Bugs.html#Reporting-Bugs
So the solution here might be simply to require GNU sed, and put it's path/name into an environment variable that can be overriden from the outside.
Contributor guide
Research direction
Start with tools/tox-venv and reproduce the reported `tox-venv py3` failure on FreeBSD. Inspect the sed expression that processes tox_ini, compare its behavior with POSIX sed, and verify the chosen compatibility fix by rerunning the same command without the unused-label error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100