__block: inconsistent escaping of the passed text #28

Closed
opened 2021-11-20 11:24:56 +00:00 by ungleich-gitea · 3 comments

For following example, \\\$ is required to produce a $ in the resulting file, but this results in loss of "idempotency".

More investigation is required, but in a nutshell escaping is inconsistent in the explore + compare vs. the writing phases.

file /etc/devfs.rules \
+	--state "exists" \
+	--mode 0400
+# This is not idempotent, there is a bug in __block with '$'
+require="__file/etc/devfs.rules" __block devfs_iocage_rules \
+	--file /etc/devfs.rules \
+	--state "present" \
+	--text '-' <<EOF
+[devfsrules_iocage=5]
+add include \\\$devfsrules_jail
+add path pf unhide
+add path pflog unhide
+add path pfsynv unhide
+EOF
For following example, `\\\$` is required to produce a `$` in the resulting file, but this results in loss of "idempotency". More investigation is required, but in a nutshell escaping is inconsistent in the explore + compare vs. the writing phases. ``` file /etc/devfs.rules \ + --state "exists" \ + --mode 0400 +# This is not idempotent, there is a bug in __block with '$' +require="__file/etc/devfs.rules" __block devfs_iocage_rules \ + --file /etc/devfs.rules \ + --state "present" \ + --text '-' <<EOF +[devfsrules_iocage=5] +add include \\\$devfsrules_jail +add path pf unhide +add path pflog unhide +add path pfsynv unhide +EOF ```
Author
Owner

mentioned in commit 3930f69456

mentioned in commit 3930f69456fd5a0d108a107e4ee61d87c9a73a56
Author
Owner

mentioned in commit 0546d6e476

mentioned in commit 0546d6e4764dae2fb362e815f2493c7786757daa
Author
Owner

mentioned in merge request !962

mentioned in merge request !962
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#28
No description provided.