Removing the --nofollow option that hasn't been working for a dozen years.
With this option, nano would simply refuse to write to any symlinked file; if anyone really used this option, they would certainly have complained. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5608 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
cca22bb10a
commit
6829241433
|
@ -1,3 +1,7 @@
|
||||||
|
2016-02-06 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/files.c (write_file): Remove the --nofollow option that hasn't
|
||||||
|
been working for a dozen years.
|
||||||
|
|
||||||
2016-02-05 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-05 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* doc/texinfo/nano.texi: Condense the descriptions of command-key
|
* doc/texinfo/nano.texi: Condense the descriptions of command-key
|
||||||
sequences and of the screen layout, mention how to enter Unicode,
|
sequences and of the screen layout, mention how to enter Unicode,
|
||||||
|
|
|
@ -177,11 +177,6 @@ editing source code.
|
||||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||||
position to the end of the line, instead of cutting the entire line.
|
position to the end of the line, instead of cutting the entire line.
|
||||||
.TP
|
.TP
|
||||||
.BR \-l ", " \-\-nofollow
|
|
||||||
If the file being edited is a symbolic link, replace the link with
|
|
||||||
a new file instead of following it. Good for editing files in
|
|
||||||
\fI/tmp\fP, perhaps?
|
|
||||||
.TP
|
|
||||||
.BR \-m ", " \-\-mouse
|
.BR \-m ", " \-\-mouse
|
||||||
Enable mouse support, if available for your system. When enabled, mouse
|
Enable mouse support, if available for your system. When enabled, mouse
|
||||||
clicks can be used to place the cursor, set the mark (with a double
|
clicks can be used to place the cursor, set the mark (with a double
|
||||||
|
|
|
@ -141,9 +141,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
|
||||||
.B set noconvert
|
.B set noconvert
|
||||||
Don't convert files from DOS/Mac format.
|
Don't convert files from DOS/Mac format.
|
||||||
.TP
|
.TP
|
||||||
.B set nofollow
|
|
||||||
Don't follow symlinks when writing files.
|
|
||||||
.TP
|
|
||||||
.B set nohelp
|
.B set nohelp
|
||||||
Don't display the two help lines at the bottom of the screen.
|
Don't display the two help lines at the bottom of the screen.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -86,9 +86,6 @@
|
||||||
## Don't convert files from DOS/Mac format.
|
## Don't convert files from DOS/Mac format.
|
||||||
# set noconvert
|
# set noconvert
|
||||||
|
|
||||||
## Don't follow symlinks when writing files.
|
|
||||||
# set nofollow
|
|
||||||
|
|
||||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||||
# set nohelp
|
# set nohelp
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ syntax "nanorc" "\.?nanorc$"
|
||||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
||||||
|
|
||||||
# Keywords
|
# Keywords
|
||||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
||||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||||
|
|
|
@ -266,11 +266,6 @@ the previous line.
|
||||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||||
position to the end of the line, instead of cutting the entire line.
|
position to the end of the line, instead of cutting the entire line.
|
||||||
|
|
||||||
@item -l
|
|
||||||
@itemx --nofollow
|
|
||||||
When writing files, if the given file is a symbolic link, it is removed
|
|
||||||
and a new file is created.
|
|
||||||
|
|
||||||
@item -m
|
@item -m
|
||||||
@itemx --mouse
|
@itemx --mouse
|
||||||
Enable mouse support, if available for your system. When enabled, mouse
|
Enable mouse support, if available for your system. When enabled, mouse
|
||||||
|
@ -720,9 +715,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
|
||||||
@item set noconvert
|
@item set noconvert
|
||||||
Don't convert files from DOS/Mac format.
|
Don't convert files from DOS/Mac format.
|
||||||
|
|
||||||
@item set nofollow
|
|
||||||
Don't follow symlinks when writing files.
|
|
||||||
|
|
||||||
@item set nohelp
|
@item set nohelp
|
||||||
Don't display the help lists at the bottom of the screen.
|
Don't display the help lists at the bottom of the screen.
|
||||||
|
|
||||||
|
|
17
src/files.c
17
src/files.c
|
@ -1805,14 +1805,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||||
if (tmp && anyexists && f_open == NULL)
|
if (tmp && anyexists && f_open == NULL)
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
|
|
||||||
/* If NOFOLLOW_SYMLINKS is set, it doesn't make sense to prepend or
|
|
||||||
* append to a symlink. Here we warn about the contradiction. */
|
|
||||||
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode)) {
|
|
||||||
statusbar(
|
|
||||||
_("Cannot prepend or append to a symlink with --nofollow set"));
|
|
||||||
goto cleanup_and_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Check whether the file (at the end of the symlink) exists. */
|
/* Check whether the file (at the end of the symlink) exists. */
|
||||||
realexists = (stat(realname, &st) != -1);
|
realexists = (stat(realname, &st) != -1);
|
||||||
|
@ -2002,15 +1994,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||||
skip_backup:
|
skip_backup:
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
|
|
||||||
* doing prepend or append. So we delete the link first, and just
|
|
||||||
* overwrite. */
|
|
||||||
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) &&
|
|
||||||
unlink(realname) == -1) {
|
|
||||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
|
||||||
goto cleanup_and_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_open == NULL) {
|
if (f_open == NULL) {
|
||||||
original_umask = umask(0);
|
original_umask = umask(0);
|
||||||
|
|
||||||
|
|
|
@ -920,7 +920,6 @@ void usage(void)
|
||||||
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
||||||
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||||
#endif
|
#endif
|
||||||
print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite"));
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
|
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -2010,7 +2009,6 @@ int main(int argc, char **argv)
|
||||||
{"constantshow", 0, NULL, 'c'},
|
{"constantshow", 0, NULL, 'c'},
|
||||||
{"rebinddelete", 0, NULL, 'd'},
|
{"rebinddelete", 0, NULL, 'd'},
|
||||||
{"help", 0, NULL, 'h'},
|
{"help", 0, NULL, 'h'},
|
||||||
{"nofollow", 0, NULL, 'l'},
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
{"mouse", 0, NULL, 'm'},
|
{"mouse", 0, NULL, 'm'},
|
||||||
#endif
|
#endif
|
||||||
|
@ -2214,9 +2212,6 @@ int main(int argc, char **argv)
|
||||||
SET(CUT_TO_END);
|
SET(CUT_TO_END);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'l':
|
|
||||||
SET(NOFOLLOW_SYMLINKS);
|
|
||||||
break;
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
case 'm':
|
case 'm':
|
||||||
SET(USE_MOUSE);
|
SET(USE_MOUSE);
|
||||||
|
|
|
@ -484,7 +484,6 @@ enum
|
||||||
CASE_SENSITIVE,
|
CASE_SENSITIVE,
|
||||||
CONST_UPDATE,
|
CONST_UPDATE,
|
||||||
NO_HELP,
|
NO_HELP,
|
||||||
NOFOLLOW_SYMLINKS,
|
|
||||||
SUSPEND,
|
SUSPEND,
|
||||||
NO_WRAP,
|
NO_WRAP,
|
||||||
AUTOINDENT,
|
AUTOINDENT,
|
||||||
|
|
|
@ -53,7 +53,6 @@ static const rcoption rcopts[] = {
|
||||||
#ifndef DISABLE_MULTIBUFFER
|
#ifndef DISABLE_MULTIBUFFER
|
||||||
{"multibuffer", MULTIBUFFER},
|
{"multibuffer", MULTIBUFFER},
|
||||||
#endif
|
#endif
|
||||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
|
||||||
{"nohelp", NO_HELP},
|
{"nohelp", NO_HELP},
|
||||||
{"nonewlines", NO_NEWLINES},
|
{"nonewlines", NO_NEWLINES},
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
|
|
Loading…
Reference in New Issue