[BUG] mount.fstab_present state should escape spaces and tabs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
If the source (name) or destination (fs_file) of an fstab entry generated by mount.fstab_present contains spaces or tabs, these need to be replaced by \040 and \011, respectively, when writing to /etc/fstab, else the line cannot be parsed. I think the same applies to mount options (fs_mntops) as well.
Setup
- on-prem machine (my laptop)
- onedir packaging
- masterless
- installed from
https://repo.saltproject.io/salt/py3/debian/12/amd64/latest
Steps to Reproduce the behavior
example:
mount.fstab_present:
- name: /dev/sda1
- fs_file: /tmp/some directory with spaces
- …
- mount: true
Expected behavior
The fstab entry should start like this:
/dev/sda1 /tmp/some\040directory\040with\040spaces …
Actual behavior
Salt places the spaces verbatim in the file.
It is possible to manually use the correct escapes in the YAML, but then mount: true won't work either, because it tries to find a mount point with the escape codes: Error while mounting /tmp/some\040directory\040with\040spaces: can't find in /etc/fstab.
Versions Report
salt-call --versions-report
Salt Version:
Salt: 3007.1
Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:30:09) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: 18.8.0
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.16.0
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.3.3
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: debian 12.7 bookworm
locale: utf-8
machine: x86_64
release: 6.1.0-25-amd64
system: Linux
version: Debian GNU/Linux 12.7 bookworm
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the mount.fstab_present state and follow how fstab entries are written and how the mount: true path looks up the mount point. Reproduce the example with spaces and tabs, then verify that source, destination, and applicable mount options are escaped in /etc/fstab and that mounting still works with the original paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100