Invalid remote code #317
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#317
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: pestaa
Hi,
Thanks for the great project!
Unfortunately I quickly run into this problem:
The problem is caused by this command:
I'm running FreeBSD 8.2-STABLE on the remote machine. The generated
code-remote
is what you'd expect:I believe the issue is due to improper argumenting. The
-i
flag gets the script, and the filename becomes the scripts, and no input file remains.I tried to pass an empty string or reorder the arguments, but my shell-fu failed me. Please advice.
Thank you very much in advance.
Created by: pestaa
Thanks Jake for the additional info!
I agree that the backup extension should be provided. However, I don't think backing up should slow the process down. The current behavior does not even create a backup file to begin with.
(Backup gets even more complicated when you consider multiple __key_value commands -- each time a new backup is created, so you need even more workaround.)
A really quick search gives 3 types that use
sed -i
:key_value
,rvm
andstart_on_boot
.Created by: telmich
Hey Jake,
thanks for clearifying!
I guess we can change to create the backup file and rm -f it afterwards.
We could even add a parameter named "keepbackup" to the types
using "sed -i" to leave the files in place.
OR (perhaps even better):
Cheers,
Nico
Want commercial support for cdist?
Have a look at http://www.ungleich.ch/offers/cdist-support/
Created by: jdguffey
After looking at GNU sed's documentation (http://www.gnu.org/software/sed/manual/sed.html), I see a minor but very important difference in how the "-i" flag is handled.
FreeBSD:
If in-place editing is to be used, a backup file extension is required.
Usage looks like: sed -i .bak /regex/ file, so after execution of sed, file and file.bak exist.
GNU:
If in-place editing is to be used, a backup file extension is allowed.
Usage can be: sed -i /regex/ file or sed -i .bak /regex/ file.
In the first case, file is simply modified in-place. In the second case, GNU and FreeBSD sed have the same behavior.
Created by: telmich
Well, one could introduce a "--sed" parameter, but that would have to be repeated in other types as well. Not sure what's the cleanest solution here. Using a tmpfile is a workaround, though not very beautiful.
I'll close this issue for now, but feel free to reopen if, if you've new ideas or findings.
Created by: pestaa
FreeBSD comes with a non-GNU version of sed, version number being approximately v1.41.2.1.2.1 (yeah, found in the sources).
Anyway, installing the GNU sed (named
gsed
in ports) solved the problem. Of coursesed
needs to be symlinked togsed
in this scenario. I think I'll have cdist do that! :)(Note to FreeBSD admins: the default sed supports some kind of GNU-compatilibity switch, but it has no effect on the command line.)
Thanks @telmich for your prompt response, really appreciated.
I'm not sure how Steve could approach this problem. Maybe replace the sed command with something more cross-platform?
Created by: telmich
Hey Istvan,
Istvan Beregszaszi [Wed, Apr 04, 2012 at 04:55:45AM -0700]:
thanks for the good feedback! (*)
Yeah, nice fbsd! Long time ago I used to use it though...
Can you check your actual sed version? It may be that GNU sed and
behaves differently.
Not sure why sed detects use of stdin. I'd suggest to look at the
source of the sed you are using and see how it detects that.
Alright, that may be possible.
If I have a look at my sed manpage, it looks like this:
sed [OPTION]... {script-only-if-no-other-script} [input-file]...
Using this sed:
[15:04] brief:
% pacman -Qo $(which sed)% pacman -Qi sed | head -n 3/bin/sed is owned by sed 4.2.1-4
[15:04] brief:
Name : sed
Version : 4.2.1-4
URL : http://www.gnu.org/software/sed
I've told Steven (the author of __key_value) about it, but we cannot
reproduce it.
Cheers,
Nico
(*) If you like cdist, it would be great if you could write a review, so
others can benefit from it as well.
Want commercial support for cdist? Have a look at http://www.ungleich.ch/offers/cdist-support/