From: Benno Schulenberg Date: Sat, 6 Feb 2016 10:59:31 +0000 (+0000) Subject: Removing the --nofollow option that hasn't been working for a dozen years. X-Git-Tag: v2.5.2~27 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=68292414330b1078a7e779193413c4c2c9833a6c;p=nano.git 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-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 237407df..e03aac09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-02-06 Benno Schulenberg + * src/files.c (write_file): Remove the --nofollow option that hasn't + been working for a dozen years. + 2016-02-05 Benno Schulenberg * doc/texinfo/nano.texi: Condense the descriptions of command-key sequences and of the screen layout, mention how to enter Unicode, diff --git a/doc/man/nano.1 b/doc/man/nano.1 index 6831be37..a3ce2fcb 100644 --- a/doc/man/nano.1 +++ b/doc/man/nano.1 @@ -177,11 +177,6 @@ editing source code. 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. .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 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 diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index 6ae2432b..2f2bdac1 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -141,9 +141,6 @@ When reading in a file with ^R, insert it into a new buffer by default. .B set noconvert Don't convert files from DOS/Mac format. .TP -.B set nofollow -Don't follow symlinks when writing files. -.TP .B set nohelp Don't display the two help lines at the bottom of the screen. .TP diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in index 6b1072e0..374f4c89 100644 --- a/doc/nanorc.sample.in +++ b/doc/nanorc.sample.in @@ -86,9 +86,6 @@ ## Don't convert files from DOS/Mac format. # set noconvert -## Don't follow symlinks when writing files. -# set nofollow - ## Don't display the helpful shortcut lists at the bottom of the screen. # set nohelp diff --git a/doc/syntax/nanorc.nanorc b/doc/syntax/nanorc.nanorc index 238416fc..4a18ce4a 100644 --- a/doc/syntax/nanorc.nanorc +++ b/doc/syntax/nanorc.nanorc @@ -6,7 +6,7 @@ syntax "nanorc" "\.?nanorc$" icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$" # 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 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:]]*$)" diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi index b841d15c..0f04ef24 100644 --- a/doc/texinfo/nano.texi +++ b/doc/texinfo/nano.texi @@ -266,11 +266,6 @@ the previous line. 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. -@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 @itemx --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 Don't convert files from DOS/Mac format. -@item set nofollow -Don't follow symlinks when writing files. - @item set nohelp Don't display the help lists at the bottom of the screen. diff --git a/src/files.c b/src/files.c index a7aa1c59..d6d220bc 100644 --- a/src/files.c +++ b/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) 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 /* Check whether the file (at the end of the symlink) exists. */ realexists = (stat(realname, &st) != -1); @@ -2002,15 +1994,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type skip_backup: #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) { original_umask = umask(0); diff --git a/src/nano.c b/src/nano.c index a50aeb03..573e18c8 100644 --- a/src/nano.c +++ b/src/nano.c @@ -920,7 +920,6 @@ void usage(void) print_opt("-i", "--autoindent", N_("Automatically indent new lines")); print_opt("-k", "--cut", N_("Cut from cursor to end of line")); #endif - print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite")); #ifndef DISABLE_MOUSE print_opt("-m", "--mouse", N_("Enable the use of the mouse")); #endif @@ -2010,7 +2009,6 @@ int main(int argc, char **argv) {"constantshow", 0, NULL, 'c'}, {"rebinddelete", 0, NULL, 'd'}, {"help", 0, NULL, 'h'}, - {"nofollow", 0, NULL, 'l'}, #ifndef DISABLE_MOUSE {"mouse", 0, NULL, 'm'}, #endif @@ -2214,9 +2212,6 @@ int main(int argc, char **argv) SET(CUT_TO_END); break; #endif - case 'l': - SET(NOFOLLOW_SYMLINKS); - break; #ifndef DISABLE_MOUSE case 'm': SET(USE_MOUSE); diff --git a/src/nano.h b/src/nano.h index e9293e18..28f1b85b 100644 --- a/src/nano.h +++ b/src/nano.h @@ -484,7 +484,6 @@ enum CASE_SENSITIVE, CONST_UPDATE, NO_HELP, - NOFOLLOW_SYMLINKS, SUSPEND, NO_WRAP, AUTOINDENT, diff --git a/src/rcfile.c b/src/rcfile.c index 7223cba5..05bf90ab 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -53,7 +53,6 @@ static const rcoption rcopts[] = { #ifndef DISABLE_MULTIBUFFER {"multibuffer", MULTIBUFFER}, #endif - {"nofollow", NOFOLLOW_SYMLINKS}, {"nohelp", NO_HELP}, {"nonewlines", NO_NEWLINES}, #ifndef DISABLE_WRAPPING