new upstream release - 2.3.2

This commit is contained in:
Kamil Dudka 2014-05-29 09:23:07 +02:00
parent 48571da717
commit 1ff25d28ed
8 changed files with 71 additions and 154 deletions

7
.gitignore vendored
View File

@ -1,5 +1,2 @@
nano-2.2.5.tar.gz
/nano-2.2.6.tar.gz
/nano-2.3.0.tar.gz
/nano-2.3.1.tar.gz
/nano-2.3.2.tar.gz
/nano-2.*.*.tar.gz
/nano-2.*.*/

View File

@ -1,19 +1,19 @@
From fc87b0a32c130a2b3ab37e614d4a1c6c8e5d70e7 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 19 Aug 2010 13:58:12 +0200
Subject: [PATCH 1/2] check stat's result and avoid calling stat on a NULL pointer
Subject: [PATCH 2/3] check stat's result and avoid calling stat on a NULL pointer
---
src/files.c | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
src/files.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/files.c b/src/files.c
index f6efbf1..99cc1b8 100644
--- a/src/files.c
+++ b/src/files.c
@@ -306,6 +306,24 @@ int do_lockfile(const char *filename)
#endif /* NANO_TINY */
@@ -300,6 +300,24 @@ int do_lockfile(const char *filename)
}
#endif /* !NANO_TINY */
+#ifndef NANO_TINY
+/* If *pstat is NULL, perform a stat call with the given file name. On success,
@ -36,7 +36,7 @@ index f6efbf1..99cc1b8 100644
/* If it's not "", filename is a file to open. We make a new buffer, if
* necessary, and then open and read the file, if applicable. */
void open_buffer(const char *filename, bool undoable)
@@ -351,11 +369,7 @@ void open_buffer(const char *filename, bool undoable)
@@ -345,11 +363,7 @@ void open_buffer(const char *filename, bool undoable)
if (rc > 0) {
read_file(f, rc, filename, undoable, new_buffer);
#ifndef NANO_TINY
@ -49,23 +49,26 @@ index f6efbf1..99cc1b8 100644
#endif
}
@@ -1741,8 +1755,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), stat and save the value
* or else we will chase null pointers when we do
* modtime checks, preserve file times, etc. during backup */
- if (openfile->current_stat == NULL && !tmp && realexists)
@@ -1737,10 +1751,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), stat and save the value now,
* or else we will chase null pointers when we do modtime checks,
* preserve file times, and so on, during backup. */
- if (openfile->current_stat == NULL && !tmp && realexists) {
- openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
- stat(realname, openfile->current_stat);
- }
+ if (!tmp && realexists)
+ stat_if_needed(realname, &openfile->current_stat);
/* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we
@@ -2134,7 +2148,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
@@ -2133,8 +2145,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
if (openfile->current_stat == NULL)
openfile->current_stat =
(struct stat *)nmalloc(sizeof(struct stat));
- stat(realname, openfile->current_stat);
+ if (stat(realname, openfile->current_stat)) {
- if (!openfile->mark_set)
- stat(realname, openfile->current_stat);
+ if (!openfile->mark_set && 0 != stat(realname, openfile->current_stat)) {
+ free(openfile->current_stat);
+ openfile->current_stat = NULL;
+ }

View File

@ -1,20 +1,20 @@
From 23510b930ea31f7de8005e2f0ff6cab7062b4e26 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 19 Aug 2010 15:23:06 +0200
Subject: [PATCH 2/2] use futimens() if available, instead of utime()
Subject: [PATCH 3/3] use futimens() if available, instead of utime()
---
config.h.in | 3 +++
configure | 2 +-
configure.ac | 2 +-
src/files.c | 48 +++++++++++++++++++++++++++++++++++-------------
4 files changed, 40 insertions(+), 15 deletions(-)
src/files.c | 26 +++++++++++++++++++++++++-
4 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/config.h.in b/config.h.in
index 52e13f1..cb17b29 100644
--- a/config.h.in
+++ b/config.h.in
@@ -64,6 +64,9 @@
@@ -66,6 +66,9 @@
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
@ -28,12 +28,12 @@ diff --git a/configure b/configure
index 02733c7..1805e53 100755
--- a/configure
+++ b/configure
@@ -7362,7 +7362,7 @@ fi
@@ -7577,7 +7577,7 @@ fi
-for ac_func in getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf
+for ac_func in futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf
-for ac_func in getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf
+for ac_func in futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -41,20 +41,20 @@ diff --git a/configure.ac b/configure.ac
index 66f8ee3..f4975d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -414,7 +414,7 @@ fi])
@@ -419,7 +419,7 @@ int main(void)
dnl Checks for functions.
-AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
+AC_CHECK_FUNCS(futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
-AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
+AC_CHECK_FUNCS(futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
if test x$enable_utf8 != xno; then
if test "x$enable_utf8" != xno; then
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
diff --git a/src/files.c b/src/files.c
index 99cc1b8..9a1bdcc 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1665,6 +1665,29 @@ int copy_file(FILE *inn, FILE *out)
@@ -1662,6 +1662,29 @@ int copy_file(FILE *inn, FILE *out)
return retval;
}
@ -84,45 +84,16 @@ index 99cc1b8..9a1bdcc 100644
/* Write a file out to disk. If f_open isn't NULL, we assume that it is
* a stream associated with the file, and we don't try to open it
* ourselves. If tmp is TRUE, we set the umask to disallow anyone else
@@ -1904,6 +1927,18 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
fprintf(stderr, "Backing up %s to %s\n", realname, backupname);
#endif
+ /* Set backup's file metadata. */
+ if (utime_wrap(backup_fd, backupname, &filetime) == -1
+ && !ISSET(INSECURE_BACKUP)) {
+ statusbar(_("Error writing backup file %s: %s"), backupname,
+ strerror(errno));
+ /* If we can't write to the backup, DONT go on, since
+ whatever caused the backup file to fail (e.g. disk
+ full may well cause the real file write to fail, which
+ means we could lose both the backup and the original! */
+ goto cleanup_and_exit;
+ }
+
/* Copy the file. */
copy_status = copy_file(f, backup_file);
@@ -1914,19 +1949,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
goto cleanup_and_exit;
@@ -1912,7 +1935,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
}
- /* And set its metadata. */
/* And set its metadata. */
- if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
- if (prompt_failed_backupwrite(backupname))
- goto skip_backup;
- statusbar(_("Error writing backup file %s: %s"), backupname,
- strerror(errno));
- /* If we can't write to the backup, DONT go on, since
- whatever caused the backup file to fail (e.g. disk
- full may well cause the real file write to fail, which
- means we could lose both the backup and the original! */
- goto cleanup_and_exit;
- }
-
free(backupname);
}
+ if (utime_wrap(backup_fd, backupname, &filetime) == -1
+ && !ISSET(INSECURE_BACKUP)) {
if (prompt_failed_backupwrite(backupname))
goto skip_backup;
statusbar(_("Error writing backup file %s: %s"), backupname,
--
1.7.4

View File

@ -1,26 +0,0 @@
From 64452244419d9b77ef62d4971bad5cdaa4dd3dfc Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 28 May 2013 15:24:19 +0200
Subject: [PATCH 3/3] Document the --poslog (-P) option in nano.1 man page.
---
doc/man/nano.1 | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/doc/man/nano.1 b/doc/man/nano.1
index 4d4d67a..c4e4782 100644
--- a/doc/man/nano.1
+++ b/doc/man/nano.1
@@ -102,6 +102,9 @@ Disable automatic conversion of files from DOS/Mac format.
.B \-O (\-\-morespace)
Use the blank line below the titlebar as extra editing space.
.TP
+.B \-P (\-\-poslog)
+Log & read location of cursor position.
+.TP
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
Set the quoting string for justifying. The default is
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
--
1.7.1

View File

@ -1,52 +0,0 @@
From 8d618f769b1e66a26e7b790e4e94b2c3dca68d31 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 26 Mar 2013 16:20:27 +0100
Subject: [PATCH] fix compile-time warnings in nano-2.3.2
---
po/Makefile.in.in | 1 +
src/nano.c | 2 +-
src/search.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index ada8bb4..f7b2a95 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -20,6 +20,7 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
datadir = @datadir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
diff --git a/src/nano.c b/src/nano.c
index 9d2332d..c315768 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1934,7 +1934,7 @@ precalc_cleanup:
* TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls)
{
- size_t current_len, orig_lenpt, i = 0;
+ size_t current_len, orig_lenpt = 0, i = 0;
char *char_buf = charalloc(mb_cur_max());
int char_buf_len;
diff --git a/src/search.c b/src/search.c
index 74bfb07..77b2097 100644
--- a/src/search.c
+++ b/src/search.c
@@ -219,7 +219,7 @@ int search_init(bool replacing, bool use_answer)
statusbar(_("Cancelled"));
return -1;
} else {
- void (*func)(void);
+ void (*func)(void) = (void (*)(void)) 0;
for (s = sclist; s != NULL; s = s->next)
if ((s->menu & currmenu) && i == s->seq) {
--
1.7.1

24
nano-2.3.3-warnings.patch Normal file
View File

@ -0,0 +1,24 @@
From 8d618f769b1e66a26e7b790e4e94b2c3dca68d31 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 26 Mar 2013 16:20:27 +0100
Subject: [PATCH 1/3] fix compile-time warnings in nano-2.3.3
---
po/Makefile.in.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index ada8bb4..f7b2a95 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -20,6 +20,7 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
datadir = @datadir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
--
1.7.1

View File

@ -1,13 +1,13 @@
Summary: A small text editor
Name: nano
Version: 2.3.2
Release: 4%{?dist}
Version: 2.3.3
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Editors
URL: http://www.nano-editor.org
Source: http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
Source2: nanorc
Patch0: nano-2.3.2-warnings.patch
Patch0: nano-2.3.3-warnings.patch
# http://lists.gnu.org/archive/html/nano-devel/2010-08/msg00004.html
Patch1: 0001-check-stat-s-result-and-avoid-calling-stat-on-a-NULL.patch
@ -15,9 +15,6 @@ Patch1: 0001-check-stat-s-result-and-avoid-calling-stat-on-a-NULL.patch
# http://lists.gnu.org/archive/html/nano-devel/2010-08/msg00005.html
Patch2: 0002-use-futimens-if-available-instead-of-utime.patch
# http://thread.gmane.org/gmane.editors.nano.devel/3081
Patch3: 0003-Document-the-poslog-P-option-in-nano.1-man-page.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf
BuildRequires: file-devel
@ -25,6 +22,7 @@ BuildRequires: gettext-devel
BuildRequires: groff
BuildRequires: ncurses-devel
BuildRequires: sed
BuildRequires: texinfo
Conflicts: filesystem < 3
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
@ -37,7 +35,6 @@ GNU nano is a small and friendly text editor.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
for f in doc/man/fr/{nano.1,nanorc.5,rnano.1} ; do
iconv -f iso-8859-1 -t utf-8 -o $f.tmp $f && mv $f.tmp $f
@ -93,6 +90,9 @@ exit 0
%{_datadir}/nano
%changelog
* Thu May 29 2014 Kamil Dudka <kdudka@redhat.com> - 2.3.3-1
- new upstream release
* Fri Aug 09 2013 Kamil Dudka <kdudka@redhat.com> - 2.3.2-4
- document the --poslog (-P) option in nano.1 man page

View File

@ -1 +1 @@
6451aeae836471cadea8567c44a46c99 nano-2.3.2.tar.gz
229ecb771c962117bdf97f75622204c9 nano-2.3.3.tar.gz