Bug 2160256

Summary: Blank lines inserted to /etc/fstab when creating nfs mounts with cockpit-storaged
Product: [Fedora] Fedora Reporter: cody6730
Component: cockpitAssignee: Martin Pitt <mpitt>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 37CC: cody6730, k.koukiou, mmarusak, mpitt, patrick, stefw, user-cont-team+packit-fas
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-19 12:48:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description cody6730 2023-01-11 21:28:06 UTC
Description of problem:
When creating NFS mounts using cockpit-storaged, existing newline characters are doubled, resulting in unwanted blank lines being inserted into /etc/fstab

Version-Release number of selected component (if applicable):
cockpit-282-1.fc37.x86_64
cockpit-storaged-282-1.fc37.noarch

How reproducible:
Always

Steps to Reproduce:
1. Navigate to storage page in cockpit (https://localhost:9090/storage)
2. Add a valid NFS mount, ensuring that 'Mount at boot' is enabled
3. Inspect /etc/fstab

Actual results:
Every newline character is doubled with each edit of NFS mounts with cockpit-storaged

Expected results:
No unwanted blank lines should be added

Additional info:
This occurs every time NFS mounts are edited with cockpit-storaged, meaning more and more blank lines end up being inserted in /etc/fstab. For an example of the problem, see below.

/etc/fstab prior to mountpoint creation:
#
# /etc/fstab
# Created by anaconda on Fri Jan 29 17:08:22 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=b62f70a2-0892-4f54-8f5a-4801383e0b25 /                       btrfs   subvol=root,x-systemd.device-timeout=0,compress=zstd:1 0 0
UUID=a9d5f7f6-f4ed-479f-90ca-bfcb102801f4 /boot                   ext4    defaults        1 2
UUID=6BA8-E6F2          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=b62f70a2-0892-4f54-8f5a-4801383e0b25 /home                   btrfs   subvol=home,x-systemd.device-timeout=0,compress=zstd:1 0 0

/etc/fstab after mountpoint creation with cockpit-storaged:
#

# /etc/fstab

# Created by anaconda on Fri Jan 29 17:08:22 2021

#

# Accessible filesystems, by reference, are maintained under '/dev/disk/'.

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.

#

# After editing this file, run 'systemctl daemon-reload' to update systemd

# units generated from this file.

#

UUID=b62f70a2-0892-4f54-8f5a-4801383e0b25 /                       btrfs   subvol=root,x-systemd.device-timeout=0,compress=zstd:1 0 0

UUID=a9d5f7f6-f4ed-479f-90ca-bfcb102801f4 /boot                   ext4    defaults        1 2

UUID=6BA8-E6F2          /boot/efi               vfat    umask=0077,shortname=winnt 0 2

UUID=b62f70a2-0892-4f54-8f5a-4801383e0b25 /home                   btrfs   subvol=home,x-systemd.device-timeout=0,compress=zstd:1 0 0

localhost:/home/user/test /home/user/mnt/test nfs defaults

Comment 1 Martin Pitt 2023-01-13 07:21:30 UTC
I can reproduce this perfectly well, even in our TestStorageNfs.testNfsClient integration test. Thanks for the report!

Comment 2 Martin Pitt 2023-01-13 08:51:16 UTC
Fixed in https://github.com/cockpit-project/cockpit/pull/18169

Comment 3 cody6730 2023-01-13 19:05:13 UTC
Great! I'll give it a test as soon as it is in bodhi.

Comment 4 Martin Pitt 2023-04-19 12:48:20 UTC
This was fixed months ago.