Closed v1shnya closed 1 year ago
It is also very possible that the environment provided by sudo does not provide EDITOR.
[/home/dev]$ EDITOR='/usr/bin/vi'
[/home/dev]$ echo $EDITOR
/usr/bin/vi
[/home/dev]$ sudo echo $EDITOR
/usr/bin/vi
using sudo
I still can see EDITOR variable
Was wrong, assignment editor=e
is correct. By the way, the same issue is also seen on Ubuntu - can't specify EDITOR envvar.
So, for me it looks like the problem is in the if(auto e=getenv("EDITOR"))
statement
this works for me (on Arch):
sudo -E EDITOR=vim pdnsutil edit-zone $ZONE
Does this (with your favorite editor) work on RHEL?
[/home/dev]$ sudo echo $EDITOR
this expands $EDITOR
before invoking sudo
Try sudo sh -c "echo PATH=\$PATH EDITOR=\$EDITOR"
[/home/dev]$ sudo sh -c "echo PATH=\$PATH EDITOR=\$EDITOR"
PATH=/sbin:/bin:/usr/sbin:/usr/bin EDITOR=
Yes, sudo -E EDITOR=vim pdnsutil edit-zone test.com
works!
Thank you! and point taken, will read about sudo invocation ;)
Short description
'pdnsutil edit-zone' doesn't work in RHEL
Environment
Steps to reproduce
Other information
I belive that the problem is related to the CHAR* to STRING assignment in the code. See it started from the line https://github.com/PowerDNS/pdns/blob/master/pdns/pdnsutil.cc#L1188
Function
char* getenv (const char* name)
returns CHAR* that can't be just assigned to STRING. Need to use type conversioneditor=str(e);