[ksh/f17] cd file did not produce any error
Michal Hlavinka
mhlavink at fedoraproject.org
Fri Feb 1 19:01:55 UTC 2013
commit 82b211bf5e7a5db686a1987605a917917ea1c9e4
Author: Michal Hlavinka <mhlavink at redhat.com>
Date: Fri Feb 1 20:01:50 2013 +0100
cd file did not produce any error
ksh-20120801-cdfix.patch | 4 ++--
ksh-20120801-cdfix2.patch | 25 +++++++++++++++++++++++++
ksh.spec | 7 ++++++-
3 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/ksh-20120801-cdfix.patch b/ksh-20120801-cdfix.patch
index 6d6c016..59265dd 100644
--- a/ksh-20120801-cdfix.patch
+++ b/ksh-20120801-cdfix.patch
@@ -1,6 +1,6 @@
diff -up ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c
---- ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix 2013-01-04 18:54:11.890462334 +0100
-+++ ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c 2013-01-04 18:54:11.914462535 +0100
+--- ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix 2013-02-01 16:04:55.507150242 +0100
++++ ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c 2013-02-01 16:06:39.361007641 +0100
@@ -214,7 +214,10 @@ int b_cd(int argc, char *argv[],Shbltin_
if(*++dp=='.' && (*++dp=='/' || *dp==0))
n++;
diff --git a/ksh-20120801-cdfix2.patch b/ksh-20120801-cdfix2.patch
new file mode 100644
index 0000000..84bb491
--- /dev/null
+++ b/ksh-20120801-cdfix2.patch
@@ -0,0 +1,25 @@
+diff -up ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix2 ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c
+--- ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c.cdfix2 2013-02-01 16:46:50.441771371 +0100
++++ ksh-20120801/src/cmd/ksh93/bltins/cd_pwd.c 2013-02-01 16:57:43.241784024 +0100
+@@ -61,6 +61,7 @@ int sh_diropenat(Shell_t *shp, int dir,
+ {
+ int fd,shfd;
+ int savederrno=errno;
++ struct stat fs;
+ #ifndef AT_FDCWD
+ NOT_USED(dir);
+ #endif
+@@ -133,6 +134,13 @@ int sh_diropenat(Shell_t *shp, int dir,
+
+ if(fd < 0)
+ return fd;
++
++ if (!fstat(fd, &fs) && !S_ISDIR(fs.st_mode))
++ {
++ close(fd);
++ errno = ENOTDIR;
++ return -1;
++ }
+
+ /* Move fd to a number > 10 and *register* the fd number with the shell */
+ shfd = sh_fcntl(fd, F_dupfd_cloexec, 10);
diff --git a/ksh.spec b/ksh.spec
index 5166d24..3150604 100644
--- a/ksh.spec
+++ b/ksh.spec
@@ -6,7 +6,7 @@ URL: http://www.kornshell.com/
Group: System Environment/Shells
License: EPL
Version: 20120801
-Release: 5%{?dist}
+Release: 6%{?dist}
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz
Source2: kshcomp.conf
@@ -23,6 +23,7 @@ Patch2: ksh-20100826-fixregr.patch
Patch3: rmdirfix.patch
Patch4: ksh-20120801-cdfix.patch
Patch5: ksh-20120801-tabfix.patch
+Patch6: ksh-20120801-cdfix2.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh
@@ -47,6 +48,7 @@ with "sh" (the Bourne Shell).
%patch3 -p1 -b .rmdirfix
%patch4 -p1 -b .cdfix
%patch5 -p1 -b .tabfix
+%patch6 -p1 -b .cdfix2
#/dev/fd test does not work because of mock
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
@@ -137,6 +139,9 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Feb 01 2013 Michal Hlavinka <mhlavink at redhat.com> - 20120801-6
+- cd file did not produce any error
+
* Fri Jan 25 2013 Michal Hlavinka <mhlavink at redhat.com> - 20120801-5
- ksh could not enter directories with path containing /.something (#889748)
- file name autocomplete prevented following numeric input (#889745)
More information about the scm-commits
mailing list