Forum: CFEngine Help
Subject: readstringlist weird behaviour when reading /proc/mounts on linux
Author: jbdenis
Link to topic: https://cfengine.com/forum/read.php?3,26596,26596#msg-26596
Hello,
I'm using CFEngine Core 3.3.5, build from source on a Linux system.
I'm trying to read the content of "/proc/mounts" using readstringlist, but it
doesn't seem to work unless I copy /proc/mounts to another folder :
body common control
{
any::
bundlesequence => { read_mounts };
}
bundle agent read_mounts {
vars:
"proc_mounts" slist => readstringlist("/proc/mounts","#[^\n]*","\n",10,4000) ;
"tmp_mounts" slist => readstringlist("/tmp/mounts","#[^\n]*","\n",10,4000) ;
reports:
linux::
"proc: $(proc_mounts)";
"tmp: $(tmp_mounts)";
}
Here is the output :
$ cp /proc/mounts /tmp/mounts
$ cf-agent -KI -f ./readmount.cf
R: proc: $(proc_mounts)
R: tmp: rootfs / rootfs rw 0 0
R: tmp: sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
R: tmp: proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
R: tmp: udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=987832,mode=755 0 0
R: tmp: devpts /dev/pts devpts
rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
R: tmp: tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=791508k,mode=755 0 0
R: tmp: /dev/disk/by-uuid/f631ed21-729b-453f-9487-958eda29ec5e / ext4
rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered 0 0
R: tmp: tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
R: tmp: tmpfs /tmp tmpfs rw,nosuid,nodev,relatime,size=1583012k 0 0
R: tmp: tmpfs /run/shm tmpfs rw,nosuid,nodev,relatime,size=1583012k 0 0
Looks like a bug to me, do you confirm ?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine