svn commit: r276854 - in stable/9: lib/libc/gen share/man/man5

2015-01-08 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Jan  8 21:17:35 2015
New Revision: 276854
URL: https://svnweb.freebsd.org/changeset/base/276854

Log:
  Belatedly MFC r241440 and r241441:
  Decode the first two fstab fields with strunvis(3). This allows having spaces
  in devices and mount paths, encoded as \s or \040.

Modified:
  stable/9/lib/libc/gen/fstab.c
  stable/9/share/man/man5/fstab.5
Directory Properties:
  stable/9/lib/libc/   (props changed)
  stable/9/share/man/man5/   (props changed)

Modified: stable/9/lib/libc/gen/fstab.c
==
--- stable/9/lib/libc/gen/fstab.c   Thu Jan  8 20:11:38 2015
(r276853)
+++ stable/9/lib/libc/gen/fstab.c   Thu Jan  8 21:17:35 2015
(r276854)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include vis.h
 #include un-namespace.h
 
 static FILE *_fs_fp;
@@ -150,11 +151,17 @@ fstabscan()
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
_fs_fstab.fs_spec = cp;
-   if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#')
+   if (_fs_fstab.fs_spec == NULL || *_fs_fstab.fs_spec == '#')
continue;
+   if (strunvis(_fs_fstab.fs_spec, _fs_fstab.fs_spec)  0)
+   goto bad;
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
_fs_fstab.fs_file = cp;
+   if (_fs_fstab.fs_file == NULL)
+   goto bad;
+   if (strunvis(_fs_fstab.fs_file, _fs_fstab.fs_file)  0)
+   goto bad;
fixfsfile();
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;

Modified: stable/9/share/man/man5/fstab.5
==
--- stable/9/share/man/man5/fstab.5 Thu Jan  8 20:11:38 2015
(r276853)
+++ stable/9/share/man/man5/fstab.5 Thu Jan  8 21:17:35 2015
(r276854)
@@ -32,7 +32,7 @@
 .\ @(#)fstab.58.1 (Berkeley) 6/5/93
 .\ $FreeBSD$
 .\
-.Dd June 7, 2011
+.Dd October 11, 2012
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -66,12 +66,20 @@ The first field,
 .Pq Fa fs_spec ,
 describes the special device or
 remote file system to be mounted.
+The contents are decoded by the
+.Xr strunvis 3
+function.
+This allows using spaces or tabs in the device name which would be
+interpreted as field separators otherwise.
 .Pp
 The second field,
 .Pq Fa fs_file ,
 describes the mount point for the file system.
 For swap partitions, this field should be specified as
 .Dq none .
+The contents are decoded by the
+.Xr strunvis 3
+function, as above.
 .Pp
 The third field,
 .Pq Fa fs_vfstype ,
@@ -338,6 +346,7 @@ resides in
 .Xr mount 8 ,
 .Xr quotacheck 8 ,
 .Xr quotaon 8 ,
+.Xr strunvis 3 ,
 .Xr swapon 8 ,
 .Xr umount 8
 .Sh HISTORY
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r274086 - head/sbin/route

2014-11-04 Thread Stefan Farfeleder
On Tue, Nov 04, 2014 at 10:21:35AM +, Alexander V. Chernikov wrote:
 Author: melifaro
 Date: Tue Nov  4 10:21:34 2014
 New Revision: 274086
 URL: https://svnweb.freebsd.org/changeset/base/274086
 
 Log:
   Put break after err() to please coverity.
   
   Reported by:Coverity
   CID:1250795
 

Shouldn't Coverity understand that err doesn't return?

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r273702 - head/tools/regression/lib/libc/nss

2014-10-26 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Oct 26 17:56:58 2014
New Revision: 273702
URL: https://svnweb.freebsd.org/changeset/base/273702

Log:
  Remove incorrect semicolon.

Modified:
  head/tools/regression/lib/libc/nss/test-gethostby.c

Modified: head/tools/regression/lib/libc/nss/test-gethostby.c
==
--- head/tools/regression/lib/libc/nss/test-gethostby.c Sun Oct 26 17:56:47 
2014(r273701)
+++ head/tools/regression/lib/libc/nss/test-gethostby.c Sun Oct 26 17:56:58 
2014(r273702)
@@ -109,7 +109,7 @@ __gethostbyname2(const char *name, int a
else {
error = 0;
he = getipnodebyname(name, af, ipnode_flags, error);
-   if (he == NULL);
+   if (he == NULL)
errno = error;
}

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r272894 - head/sys/dev/mc146818

2014-10-10 Thread Stefan Farfeleder
On Fri, Oct 10, 2014 at 02:17:43PM +, Baptiste Daroussin wrote:
 Author: bapt
 Date: Fri Oct 10 14:17:42 2014
 New Revision: 272894
 URL: https://svnweb.freebsd.org/changeset/base/272894
 
 Log:
   Use FreeBSD-bit-checking-style
   This appease gcc 4.9 issuing warnings about parentheses
   
   Differential Revision:  https://reviews.freebsd.org/D933
   Reviewed by:marius
 
 Modified:
   head/sys/dev/mc146818/mc146818.c
 
 Modified: head/sys/dev/mc146818/mc146818.c
 ==
 --- head/sys/dev/mc146818/mc146818.c  Fri Oct 10 12:38:53 2014
 (r272893)
 +++ head/sys/dev/mc146818/mc146818.c  Fri Oct 10 14:17:42 2014
 (r272894)
 @@ -77,7 +77,7 @@ mc146818_attach(device_t dev)
   }
  
   mtx_lock_spin(sc-sc_mtx);
 - if (!(*sc-sc_mcread)(dev, MC_REGD)  MC_REGD_VRT) {
 + if (((*sc-sc_mcread)(dev, MC_REGD)  MC_REGD_VRT) == 0) {
   mtx_unlock_spin(sc-sc_mtx);
   device_printf(dev, %s: battery low\n, __func__);
   return (ENXIO);

This changes the meaning. The old code was parsed as
'(!...)  MC_REGD_VRT' which evaluates to constant 0.
Probably this was wrong, but your comment doesn't seem to indicate that.

The other two changes are fine.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r272505 - in head/sys: kern sys

2014-10-05 Thread Stefan Farfeleder
On Sat, Oct 04, 2014 at 02:21:54PM +, Bjoern A. Zeeb wrote:
 
 On 04 Oct 2014, at 08:08 , Mateusz Guzik m...@freebsd.org wrote:
 
  Author: mjg
  Date: Sat Oct  4 08:08:56 2014
  New Revision: 272505
  URL: https://svnweb.freebsd.org/changeset/base/272505
  
  Log:
   Plug capability races.
  
   fp and appropriate capability lookups were not atomic, which could result 
  in
   improper capabilities being checked.
  
   This could result either in protection bypass or in a spurious ENOTCAPABLE.
  
   Make fp + capability check atomic with the help of sequence counters.
  
   Reviewed by:   kib
   MFC after: 3 weeks
  
  Modified:
   head/sys/kern/kern_descrip.c
   head/sys/sys/filedesc.h
  …
 
 
 This file is included from user space.  There is no opt_capsicum.h there.
 Including an opt_* in the header file seems wrong in a lot of ways usually.
 
 I tried to add a bandaid for the moment with r272523 which (to be honest) 
 makes it worse.
 
 This needs a better fix.

Hi,

this also breaks the nvidia-driver port (also with your fix).

BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r272505 - in head/sys: kern sys

2014-10-05 Thread Stefan Farfeleder
On Sun, Oct 05, 2014 at 08:16:17PM +0300, Konstantin Belousov wrote:
 On Sun, Oct 05, 2014 at 06:39:54PM +0200, Stefan Farfeleder wrote:
  On Sat, Oct 04, 2014 at 02:21:54PM +, Bjoern A. Zeeb wrote:
   
   On 04 Oct 2014, at 08:08 , Mateusz Guzik m...@freebsd.org wrote:
   
Author: mjg
Date: Sat Oct  4 08:08:56 2014
New Revision: 272505
URL: https://svnweb.freebsd.org/changeset/base/272505

Log:
 Plug capability races.

 fp and appropriate capability lookups were not atomic, which could 
result in
 improper capabilities being checked.

 This could result either in protection bypass or in a spurious 
ENOTCAPABLE.

 Make fp + capability check atomic with the help of sequence counters.

 Reviewed by:   kib
 MFC after: 3 weeks

Modified:
 head/sys/kern/kern_descrip.c
 head/sys/sys/filedesc.h
???
   
   
   This file is included from user space.  There is no opt_capsicum.h there.
   Including an opt_* in the header file seems wrong in a lot of ways 
   usually.
   
   I tried to add a bandaid for the moment with r272523 which (to be honest) 
   makes it worse.
   
   This needs a better fix.
  
  Hi,
  
  this also breaks the nvidia-driver port (also with your fix).
 
 Is the breakage due to missing opt_capsicum.h file ?
 If yes, what I proposed, i.e. making the new member unconditional,
 should fix it without changes to the module build system.

Yes, it breaks due to the missing file.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r269188 - head/sys/dev/vt

2014-07-28 Thread Stefan Farfeleder
On Mon, Jul 28, 2014 at 02:22:34PM +, Aleksandr Rybalko wrote:
 Author: ray
 Date: Mon Jul 28 14:22:34 2014
 New Revision: 269188
 URL: http://svnweb.freebsd.org/changeset/base/269188
 
 Log:
   Avoid embedding buffers into static virtual terminal window.
   
   MFC after:  1 week
   Sponsored by:   The FreeBSD Foundation
 
 Modified:
   head/sys/dev/vt/vt_core.c
 
 Modified: head/sys/dev/vt/vt_core.c
 ==
 --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:20:31 2014(r269187)
 +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:22:34 2014(r269188)
 @@ -166,8 +166,8 @@ static struct vt_window   vt_conswindow = 
   .vw_number = VT_CONSWINDOW,
   .vw_flags = VWF_CONSOLE,
   .vw_buf = {
 - .vb_buffer = vt_constextbuf,
 - .vb_rows = vt_constextbufrows,
 + .vb_buffer = vt_constextbuf[0],
 + .vb_rows = vt_constextbufrows[0],
   .vb_history_size = VBF_DEFAULT_HISTORY_SIZE,
   .vb_curroffset = 0,
   .vb_roffset = 0,
 

Hi Aleksandr,

What's that supposed to change exactly? I'd be very surprised if it
didn't produce the same binary code.

BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268889 - in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel usr.sbin/bhyve usr.sbin/bhyvectl

2014-07-20 Thread Stefan Farfeleder
Hi,

On Sat, Jul 19, 2014 at 08:59:08PM +, Neel Natu wrote:
 Author: neel
 Date: Sat Jul 19 20:59:08 2014
 New Revision: 268889
 URL: http://svnweb.freebsd.org/changeset/base/268889

snip

 Modified: head/sys/amd64/vmm/intel/vmx.c
 ==
 --- head/sys/amd64/vmm/intel/vmx.cSat Jul 19 20:55:13 2014
 (r26)
 +++ head/sys/amd64/vmm/intel/vmx.cSat Jul 19 20:59:08 2014
 (r268889)
 @@ -1213,22 +1213,31 @@ vmx_inject_interrupts(struct vmx *vmx, i
  {
   struct vm_exception exc;
   int vector, need_nmi_exiting, extint_pending;
 - uint64_t rflags;
 + uint64_t rflags, entryinfo;
   uint32_t gi, info;
  
 - if (vm_exception_pending(vmx-vm, vcpu, exc)) {
 - KASSERT(exc.vector = 0  exc.vector  32,
 - (%s: invalid exception vector %d, __func__, exc.vector));
 + if (vm_entry_intinfo(vmx-vm, vcpu, entryinfo)) {
 + KASSERT((entryinfo  VMCS_INTR_VALID) != 0, (%s: entry 
 + intinfo is not valid: %#lx, __func__, entryinfo));
  
   info = vmcs_read(VMCS_ENTRY_INTR_INFO);
   KASSERT((info  VMCS_INTR_VALID) == 0, (%s: cannot inject 
pending exception %d: %#x, __func__, exc.vector, info));
  

/usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1214:22: error: unused 
variable 'exc' [-Werror,-Wunused-variable]
struct vm_exception exc;
^
1 error generated.

Printing the uninitialised object in the KASSERT is most probably wrong.

BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268869 - in head/sys: amd64/amd64 cddl/dev/dtrace/amd64 cddl/dev/fbt

2014-07-20 Thread Stefan Farfeleder
Hi,

On Sat, Jul 19, 2014 at 02:27:32AM +, Mark Johnston wrote:
 Author: markj
 Date: Sat Jul 19 02:27:31 2014
 New Revision: 268869
 URL: http://svnweb.freebsd.org/changeset/base/268869

snip

 Modified: head/sys/amd64/amd64/trap.c
 ==
 --- head/sys/amd64/amd64/trap.c   Sat Jul 19 02:15:28 2014
 (r268868)
 +++ head/sys/amd64/amd64/trap.c   Sat Jul 19 02:27:31 2014
 (r268869)
 @@ -97,7 +97,8 @@ PMC_SOFT_DEFINE( , , page_fault, write);
  #include sys/dtrace_bsd.h
  #endif
  
 -extern void trap(struct trapframe *frame);
 +extern void __noinline trap(struct trapframe *frame);
 +extern void trap_check(struct trapframe *frame);
  extern void syscall(struct trapframe *frame);
  void dblfault_handler(struct trapframe *frame);
  
 @@ -604,6 +605,19 @@ out:
   return;
  }
  
 +/*
 + * Ensure that we ignore any DTrace-induced faults. This function cannot
 + * be instrumented, so it cannot generate such faults itself.
 + */
 +void
 +trap_check(struct trapframe *frame)
 +{
 +
 + if (dtrace_trap_func != NULL  (*dtrace_trap_func)(frame))
 + return;
 + trap(frame);
 +}
 +
  static int

/usr/src/sys/amd64/amd64/trap.c:616:6: error: use of undeclared identifier 
'dtrace_trap_func'
if (dtrace_trap_func != NULL  (*dtrace_trap_func)(frame))
^

This is without KDTRACE_HOOKS.


BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268045 - in head/sys: amd64/conf i386/conf

2014-07-06 Thread Stefan Farfeleder
On Mon, Jun 30, 2014 at 04:18:38PM +, Ed Maste wrote:
 Author: emaste
 Date: Mon Jun 30 16:18:38 2014
 New Revision: 268045
 URL: http://svnweb.freebsd.org/changeset/base/268045
 
 Log:
   Add vt(4) to GENERIC and retire the separate VT config
   
   vt(4) and sc(4) can now coexist in the same kernel.  To choose the vt
   driver, set the loader tunable kern.vty=vt .

Hi Ed,

I just added `device vt' to my kernel and set kern.vty=vt, but got no
output at all upon rebooting. I tried setting hw.vga.textmode=1 as found
in the man page but that didn't change anything.

Only on the Wiki page I then found I need `device vt_vga' as well. With
this it works for me now. In case it matters I have an nVidia graphic
card and nvidia.ko loaded.

Would it be possible to make this a runtime printf if missing? Or at
least it should be added to vt(4) (there doesn't seem to be a man page
for vt_vga) and maybe UPDATING.

BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r267675 - head/lib/libc/regex

2014-06-20 Thread Stefan Farfeleder
On Fri, Jun 20, 2014 at 03:29:10PM +, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Fri Jun 20 15:29:09 2014
 New Revision: 267675
 URL: http://svnweb.freebsd.org/changeset/base/267675
 
 Log:
   regex: Make use of reallocf().
   
   Use of reallocf is useful in libraries as we are not certain the
   application will exit after NULL.
   
   This somewhat reduces portability but if since you are building
   this as part of libc it is likely you have our non-standard
   reallocf(3) already.
   
   Reviewed by:ache
   MFC after:  5 days
 
 Modified:
   head/lib/libc/regex/regcomp.c
 
 Modified: head/lib/libc/regex/regcomp.c
 ==
 --- head/lib/libc/regex/regcomp.c Fri Jun 20 13:26:49 2014
 (r267674)
 +++ head/lib/libc/regex/regcomp.c Fri Jun 20 15:29:09 2014
 (r267675)
 @@ -,7 +,7 @@ allocset(struct parse *p)
  {
   cset *cs, *ncs;
  
 - ncs = realloc(p-g-sets, (p-g-ncsets + 1) * sizeof(*ncs));
 + ncs = reallocf(p-g-sets, (p-g-ncsets + 1) * sizeof(*ncs));
   if (ncs == NULL) {
   SETERROR(REG_ESPACE);
   return (NULL);
 @@ -1174,7 +1174,7 @@ CHadd(struct parse *p, cset *cs, wint_t 
   if (ch  NC)
   cs-bmp[ch  3] |= 1  (ch  7);
   else {
 - newwides = realloc(cs-wides, (cs-nwides + 1) *
 + newwides = reallocf(cs-wides, (cs-nwides + 1) *
   sizeof(*cs-wides));
   if (newwides == NULL) {
   SETERROR(REG_ESPACE);

Hi Pedro,

I don't think these changes are OK. If reallocf() fails here, the
cs-wides pointer will be freed and later freeset() will call
free(cs-wides), probably crashing. The other cases are most probably
similar though I haven't examined them closely.

BR,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r261801 - head/contrib/libc++/include

2014-02-13 Thread Stefan Farfeleder
On Wed, Feb 12, 2014 at 06:14:50PM +, Dimitry Andric wrote:
 Author: dim
 Date: Wed Feb 12 18:14:49 2014
 New Revision: 261801
 URL: http://svnweb.freebsd.org/changeset/base/261801
 
 Log:
   An ABI incompatibility crept into the libc++ 3.4 import in r261283.  It
   was caused by upstream libc++ commit r194536, which aimed to make the
   headers more standards-compliant, by making std::pair's copy constructor
   trivial.  Unfortunately, this could cause certain C++ applications using
   shared libraries built against the previous version of libc++ to crash.
   
   Fix the ABI incompatibility by making std::pair's copy constructor
   non-trivial again.
   
   Please note: Any C++ applications or shared libraries built with libc++
   between r261283 and this revision should be recompiled.

Thanks!
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r261283 - in head: contrib/libc++ contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src etc/mtree lib/libc++ sys/sys tools/build/mk

2014-02-04 Thread Stefan Farfeleder
On Mon, Feb 03, 2014 at 07:54:01PM +0100, Dimitry Andric wrote:
 On 03 Feb 2014, at 13:32, Stefan Farfeleder stef...@freebsd.org wrote:
  On Thu, Jan 30, 2014 at 07:44:23AM +, Dimitry Andric wrote:
  Author: dim
  Date: Thu Jan 30 07:44:22 2014
  New Revision: 261283
  URL: http://svnweb.freebsd.org/changeset/base/261283
  
  Log:
   Import libc++ 3.4 release.  This contains a lot of bugfixes, and some
   preliminary support for C++1y.
  
   MFC after:3 weeks
  
  Hi Dimitry,
  
  Is this expected to change the ABI? I had to recompile the boost
  libraries to stop my applications from crashing.
 
 As far as I know, this should not change the ABI.  But maybe boost does
 something strange, it would not amaze me.  Do you have any coredumps or
 actual crash reports you could share?

At the moment I can only provide a backtrace, a very simple test program
doesn't crash (of course). I'll try to come up with something later or
tomorrow. What might be interesting is that
boost::program_options::variables_map derives from std::map.

Here's the backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 806806400 (LWP 100777)]
compare (this=optimized out, __str=...) at /usr/include/c++/v1/string:3585
3585size_t __rhs_sz = __str.size();
(gdb) bt
#0  compare (this=optimized out, __str=...) at /usr/include/c++/v1/string:3585
#1  operatorchar, std::__1::char_traitschar, std::__1::allocatorchar  
(__lhs=..., __rhs=...)
at /usr/include/c++/v1/string:3769
#2  operator() (this=optimized out, __x=..., __y=...) at 
/usr/include/c++/v1/__functional_base:63
#3  std::__1::__treestd::__1::basic_stringchar, std::__1::char_traitschar, 
std::__1::allocatorchar , std::__1::lessstd::__1::basic_stringchar, 
std::__1::char_traitschar, std::__1::allocatorchar  , 
std::__1::allocatorstd::__1::basic_stringchar, std::__1::char_traitschar, 
std::__1::allocatorchar   ::__find_equalstd::__1::basic_stringchar, 
std::__1::char_traitschar, std::__1::allocatorchar   (this=optimized 
out, __parent=@0x7fffb758: 0x7fffb8b0, __v=...)
at /usr/include/c++/v1/__tree:1613
#4  0x0008009b5f41 in std::__1::__treestd::__1::basic_stringchar, 
std::__1::char_traitschar, std::__1::allocatorchar , 
std::__1::lessstd::__1::basic_stringchar, std::__1::char_traitschar, 
std::__1::allocatorchar  , std::__1::allocatorstd::__1::basic_stringchar, 
std::__1::char_traitschar, std::__1::allocatorchar   ::__insert_unique 
(this=0x7fffb8e0, __v=...)
at /usr/include/c++/v1/__tree:1867
#5  0x0008034ca383 in 
boost::program_options::store(boost::program_options::basic_parsed_optionschar
 const, boost::program_options::variables_map, bool) ()
   from /usr/local/lib/libboost_program_options.so.5

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r261283 - in head: contrib/libc++ contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src etc/mtree lib/libc++ sys/sys tools/build/mk

2014-02-03 Thread Stefan Farfeleder
On Thu, Jan 30, 2014 at 07:44:23AM +, Dimitry Andric wrote:
 Author: dim
 Date: Thu Jan 30 07:44:22 2014
 New Revision: 261283
 URL: http://svnweb.freebsd.org/changeset/base/261283
 
 Log:
   Import libc++ 3.4 release.  This contains a lot of bugfixes, and some
   preliminary support for C++1y.
   
   MFC after:  3 weeks

Hi Dimitry,

Is this expected to change the ABI? I had to recompile the boost
libraries to stop my applications from crashing.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r257133 - head/sys/dev/iwn

2013-10-29 Thread Stefan Farfeleder
On Mon, Oct 28, 2013 at 09:27:30PM -0700, Adrian Chadd wrote:
 I've filed a PR.
 
 Please update to -HEAD and test.

Ok thanks, will do. Probably I won't be able before tomorrow though.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r257133 - head/sys/dev/iwn

2013-10-28 Thread Stefan Farfeleder
On Mon, Oct 28, 2013 at 10:17:02AM -0700, Adrian Chadd wrote:
 Ping, any response?
 
 I'd like to narrow down what's going on here.

Yeah, I'll have results soon, at the moment rebuilding my kernel. 

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r257133 - head/sys/dev/iwn

2013-10-28 Thread Stefan Farfeleder
On Mon, Oct 28, 2013 at 10:17:02AM -0700, Adrian Chadd wrote:
 Ping, any response?
 
 I'd like to narrow down what's going on here.

http://pastebin.com/veDsb0Xj

Does this help in any way?

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r257133 - head/sys/dev/iwn

2013-10-28 Thread Stefan Farfeleder
On Mon, Oct 28, 2013 at 12:07:17PM -0700, Adrian Chadd wrote:
 Yeah:
 
 Oct 28 19:43:43 mole kernel: iwn5000_tx_done: qid 3 idx 4 retries 7
 nkill 0 rate a902 duration 686 status 83
 
 status 0x83 is LONG_LIMIT, which meant it tried to transmit and it
 failed to get an ACK each time.
 
 The rate control says:
 
 0x02: the rate in question
 bit 8: MCS
 bit 11: HT40
 bits 14+15: transmit antennas A+B
 
 .. and it's an association/management frame, which is odd as they're
 not supposed to be sent as 11n HT40 frames like this.
 
 can you do the same experiment but with the patch reverted? I'd like
 to see what the selected rate is.

Ok, here's the output with r257155 and r257133 reverted:

http://pastebin.com/CJzsTANv

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r257133 - head/sys/dev/iwn

2013-10-27 Thread Stefan Farfeleder
On Fri, Oct 25, 2013 at 07:44:54PM +, Adrian Chadd wrote:
 Author: adrian
 Date: Fri Oct 25 19:44:53 2013
 New Revision: 257133
 URL: http://svnweb.freebsd.org/changeset/base/257133
 
 Log:
   Temporarily disable multi-rate retry (link quality) and eliminate rate
   index lookups.
   
   * My recent(ish) change to iwn(4) and the net80211 rate control API to
 support 11n rates broke the link quality table use.  So, until I or
 someone else decides to fix it, let's just disable it for now.
   
   * Teach iwn_tx_data_raw() to use the iwn_rate_to_plcp() function.
   
   * Eliminate two uses of the net80211 rate index lookup functions - they
 are only for legacy rates and they're not needed here.
   
   This fixes some invalid looking rate control TX issues that showed up
   on my 4965 but it doesn't fix the two TX hangs I've noticed. Those look
   like DMA related issues.
   
   Tested:
   
   * 4965, STA mode
   * 5100, STA mode

Hi Adrian,

this change completely broke iwn for me. It's a

iwn0: Intel WiFi Link 5100 mem 0xf1ffe000-0xf1ff irq 17 at device 0.0 on 
pci12

built-in device in a Dell Precision m4400.

With this change, wpa_supplicant cannot associate any longer. In the
logs I see every few seconds

Oct 27 10:57:37 mole wpa_supplicant[2256]: wlan0: Trying to associate with 
xx:xx:xx:xx:xx:xx (SSID='xx' freq=2427 MHz)
Oct 27 10:57:47 mole wpa_supplicant[2256]: wlan0: Authentication with 
xx:xx:xx:xx:xx:xx timed out.
Oct 27 10:57:47 mole wpa_supplicant[2256]: wlan0: CTRL-EVENT-DISCONNECTED 
bssid=xx:xx:xx:xx:xx:xx reason=3 locally_generated=1

If I revert just this revision based on a r257155 checkout, it works
again.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r250806 - head/sys/sys

2013-05-20 Thread Stefan Farfeleder
On Tue, May 21, 2013 at 01:15:11AM +1000, Bruce Evans wrote:
 On Mon, 20 May 2013, Stefan Farfeleder wrote:
 
  I think you misunderstood what I meant. We now have quiet a few
  occurrences of `#ifdef lint' or equivalent in /usr/include. I think those
  should be changed to `#ifdef __lint' to allow application code to do
 
  #define lint foo
  #include header.h
 
  which is perfectly fine POSIX code (at least to my knowledge) and should
  not change the behaviour of the included header.
 
 lint actually predefines __LINT__, not __lint.

__LINT__ is fine with me. I didn't bother to read lint's source, but the
man page states:

The lint utility runs the C preprocessor as its first phase, with the
preprocessor symbol “lint” defined to allow certain questionable code to be
altered or skipped by lint.  Therefore, this symbol should be thought of as a
reserved word for all code that is to be checked by lint.

 Of course it is a bug that system headers depend on symbols in the
 application namespace like lint.  My version never had the lint ifdef(s)
 in sys/cdefs.h.  I don't like them for other reasons.  They results in
 lint checking different source code to what the compiler sees.  FreeBSD's
 lint barely supports C90, but C99 features like C99 initializers are now
 used extensively, at least in the kernel.  Use of features like this
 can't be hidden from lint using a few ifdefs in headers.

Since nobody wants to update lint to recent C standards, maybe it's time to
remove it?

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r250806 - head/sys/sys

2013-05-19 Thread Stefan Farfeleder
On Sun, May 19, 2013 at 07:44:02AM +, Ed Schouten wrote:
 Author: ed
 Date: Sun May 19 07:44:01 2013
 New Revision: 250806
 URL: http://svnweb.freebsd.org/changeset/base/250806
 
 Log:
   Remove lint case for _Thread_local.
   
   I added this block, knowing that lint does not support _Thread_local.
   When linting, we could argue that we don't care about TLS (yet). It
   seems, however, that external pieces of software also sometimes do a
   -Dlint, regex the output and compile it again.

Shouldn't we fix lint and our headers to use a different macro name? One
starting with __?

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r250242 - head/tools/regression/usr.bin/xargs

2013-05-04 Thread Stefan Farfeleder
Author: stefanf
Date: Sat May  4 16:41:14 2013
New Revision: 250242
URL: http://svnweb.freebsd.org/changeset/base/250242

Log:
  Add a few xargs tests related to -0, -n and quoting.

Added:
  head/tools/regression/usr.bin/xargs/regress.0.in   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.0.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.0I.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.0J.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.0L.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.n1.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.n2.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.n3.out   (contents, props changed)
  head/tools/regression/usr.bin/xargs/regress.quotes.in   (contents, props 
changed)
  head/tools/regression/usr.bin/xargs/regress.quotes.out   (contents, props 
changed)
Modified:
  head/tools/regression/usr.bin/xargs/regress.sh

Added: head/tools/regression/usr.bin/xargs/regress.0.in
==
Binary file. No diff available.

Added: head/tools/regression/usr.bin/xargs/regress.0.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.0.out   Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,8 @@
+quick ' brown
+fox jumped
+over   the lazy
+dog
+quick brown fox
+jumped over the
+lazy dog
+

Added: head/tools/regression/usr.bin/xargs/regress.0I.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.0I.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,18 @@
+The quick ' brown quick ' brownquick ' brown quick ' brown
+The fox jumped
+over   the lazy fox jumped
+over   the lazyfox jumped
+over   the lazy fox jumped
+over   the lazy
+The   
+The dog
+quick brown fox dog
+quick brown foxdog
+quick brown fox dog
+quick brown fox
+The jumped over the jumped over thejumped over the jumped over the
+The lazy dog
+ lazy dog
+lazy dog
+ lazy dog
+

Added: head/tools/regression/usr.bin/xargs/regress.0J.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.0J.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,4 @@
+The quick ' brown fox jumped
+over   the lazy dog
+quick brown fox jumped over the lazy dog
+ again.

Added: head/tools/regression/usr.bin/xargs/regress.0L.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.0L.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,6 @@
+quick ' brown fox jumped
+over   the lazy
+dog
+quick brown fox
+jumped over the lazy dog
+

Added: head/tools/regression/usr.bin/xargs/regress.n1.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.n1.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,8 @@
+quick
+brown
+fox
+jumped
+over
+the
+lazy
+dog

Added: head/tools/regression/usr.bin/xargs/regress.n2.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.n2.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the
+lazy dog

Added: head/tools/regression/usr.bin/xargs/regress.n3.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.n3.out  Sat May  4 16:41:14 
2013(r250242)
@@ -0,0 +1,3 @@
+quick brown fox
+jumped over the
+lazy dog

Added: head/tools/regression/usr.bin/xargs/regress.quotes.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.quotes.in   Sat May  4 
16:41:14 2013(r250242)
@@ -0,0 +1,4 @@
+a 'b c' \'d
+e\ f g ' h
+i\
+j

Added: head/tools/regression/usr.bin/xargs/regress.quotes.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/xargs/regress.quotes.out  Sat May  4 
16:41:14 2013(r250242)
@@ -0,0 +1,7 

Re: svn commit: r249083 - in head: rescue/rescue sbin sbin/atacontrol share/man/man4 sys/amd64/conf sys/arm/conf sys/cam/ata sys/conf sys/dev/ata sys/dev/ata/chipsets sys/i386/conf sys/ia64/conf sys/m

2013-04-06 Thread Stefan Farfeleder
On Thu, Apr 04, 2013 at 07:12:24AM +, Alexander Motin wrote:
 Author: mav
 Date: Thu Apr  4 07:12:24 2013
 New Revision: 249083
 URL: http://svnweb.freebsd.org/changeset/base/249083
 
 Log:
   Remove all legacy ATA code parts, not used since options ATA_CAM enabled in
   most kernels before FreeBSD 9.0.  Remove such modules and respective kernel
   options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam.  Remove the
   atacontrol utility and some man pages.  Remove useless now options ATA_CAM.

I think at least the removal of the ATA_CAM option should be worth a
note in UPDATING.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Stefan Farfeleder
On Wed, Feb 20, 2013 at 09:32:43AM +, David Chisnall wrote:
 On 20 Feb 2013, at 08:25, m...@freebsd.org wrote:
 
  These should be declared const int *.  And the cast shouldn't be
  needed in C, since void * can be assigned to any other pointer type.
 
 In fact, the entire function body can be replaced with:
 
   return (*(int*)p1 - *(int*)p2);
 
 qsort doesn't require that you return -1, 0, or 1, it requires you return 0, 
 0, or 0.

The subtraction might overflow and give wrong results. It won't for
these specific elements, but it would be a bad example, IMHO.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r244604 - head/usr.sbin/gssd

2012-12-23 Thread Stefan Farfeleder
On Sat, Dec 22, 2012 at 11:21:17PM +, Rick Macklem wrote:
 Author: rmacklem
 Date: Sat Dec 22 23:21:17 2012
 New Revision: 244604
 URL: http://svnweb.freebsd.org/changeset/base/244604
 
 Log:
   It was reported via email that some sshds create kerberos
   credential cache files with names other than /tmp/krb5cc_uid.
   The gssd daemon does not know how to find these credential caches.
   This patch implements a new option -s that does a search for
   credential cache files, using roughly the same algorithm as the
   gssd daemon for Linux uses. The gssd behaviour is only changed
   if the new -s option is specified. It also implements two other
   new options related to the -s option.
   
   Reported by:Piete.Brooks at cl.cam.ac.uk, Herbert Poeckl
   Tested by:  Herbert Poeckl (admin at ist.tugraz.at), Illias A. Marinos
   MFC after:  2 weeks
 
 Modified:
   head/usr.sbin/gssd/gssd.c

I think you forgot to add -lkrb5 to the Makefile.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r241439 - head/lib/libc/gen

2012-10-11 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct 11 07:39:51 2012
New Revision: 241439
URL: http://svn.freebsd.org/changeset/base/241439

Log:
  Apply some style. Checked with md5.

Modified:
  head/lib/libc/gen/fstab.c

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Thu Oct 11 06:43:43 2012(r241438)
+++ head/lib/libc/gen/fstab.c   Thu Oct 11 07:39:51 2012(r241439)
@@ -76,7 +76,7 @@ setfstab(const char *file)
 }
 
 const char *
-getfstab (void)
+getfstab(void)
 {
 
if (fsp_set)
@@ -86,7 +86,7 @@ getfstab (void)
 }
 
 static void
-fixfsfile()
+fixfsfile(void)
 {
static char buf[sizeof(_PATH_DEV) + MNAMELEN];
struct stat sb;
@@ -108,7 +108,7 @@ fixfsfile()
 }
 
 static int
-fstabscan()
+fstabscan(void)
 {
char *cp, *p;
 #defineMAXLINELENGTH   1024
@@ -119,7 +119,7 @@ fstabscan()
for (;;) {
 
if (!(p = fgets(line, sizeof(line), _fs_fp)))
-   return(0);
+   return (0);
 /* OLD_STYLE_FSTAB */
++LineNo;
if (*line == '#' || *line == '\n')
@@ -140,7 +140,7 @@ fstabscan()
_fs_fstab.fs_freq = atoi(cp);
if ((cp = strsep(p, :\n)) != NULL) {
_fs_fstab.fs_passno = atoi(cp);
-   return(1);
+   return (1);
}
}
}
@@ -206,7 +206,7 @@ fstabscan()
if (typexx)
continue;
if (cp != NULL)
-   return(1);
+   return (1);
 
 bad:   /* no way to distinguish between EOF and syntax error */
error(EFTYPE);
@@ -215,44 +215,45 @@ bad:  /* no way to distinguish between E
 }
 
 struct fstab *
-getfsent()
+getfsent(void)
 {
+
if ((!_fs_fp  !setfsent()) || !fstabscan())
-   return((struct fstab *)NULL);
-   return(_fs_fstab);
+   return (NULL);
+   return (_fs_fstab);
 }
 
 struct fstab *
-getfsspec(name)
-   const char *name;
+getfsspec(const char *name)
 {
+
if (setfsent())
while (fstabscan())
if (!strcmp(_fs_fstab.fs_spec, name))
-   return(_fs_fstab);
-   return((struct fstab *)NULL);
+   return (_fs_fstab);
+   return (NULL);
 }
 
 struct fstab *
-getfsfile(name)
-   const char *name;
+getfsfile(const char *name)
 {
+
if (setfsent())
while (fstabscan())
if (!strcmp(_fs_fstab.fs_file, name))
-   return(_fs_fstab);
-   return((struct fstab *)NULL);
+   return (_fs_fstab);
+   return (NULL);
 }
 
-int 
-setfsent()
+int
+setfsent(void)
 {
int fd;
 
if (_fs_fp) {
rewind(_fs_fp);
LineNo = 0;
-   return(1);
+   return (1);
}
if (fsp_set == 0) {
if (issetugid())
@@ -268,16 +269,17 @@ setfsent()
_fs_fp = fdopen(fd, r);
if (_fs_fp  != NULL) {
LineNo = 0;
-   return(1);
+   return (1);
}
error(errno);
_close(fd);
-   return(0);
+   return (0);
 }
 
 void
-endfsent()
+endfsent(void)
 {
+
if (_fs_fp) {
(void)fclose(_fs_fp);
_fs_fp = NULL;
@@ -287,8 +289,7 @@ endfsent()
 }
 
 static void
-error(err)
-   int err;
+error(int err)
 {
char *p;
char num[30];
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r241440 - in head: lib/libc/gen share/man/man5

2012-10-11 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct 11 07:54:29 2012
New Revision: 241440
URL: http://svn.freebsd.org/changeset/base/241440

Log:
  Decode the first two fstab fields with strunvis(3). This allows having spaces
  in devices and mount paths, encoded as \s or \040.
  
  PR:   bin/117687
  Submitted by: Martin Kammerhofer
  Discussed on: arch

Modified:
  head/lib/libc/gen/fstab.c
  head/share/man/man5/fstab.5

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Thu Oct 11 07:39:51 2012(r241439)
+++ head/lib/libc/gen/fstab.c   Thu Oct 11 07:54:29 2012(r241440)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include vis.h
 #include un-namespace.h
 
 static FILE *_fs_fp;
@@ -149,11 +150,15 @@ fstabscan(void)
 /* OLD_STYLE_FSTAB */
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
+   if (strunvis(cp, cp)  0)
+   goto bad;
_fs_fstab.fs_spec = cp;
if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#')
continue;
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
+   if (strunvis(cp, cp)  0)
+   goto bad;
_fs_fstab.fs_file = cp;
fixfsfile();
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')

Modified: head/share/man/man5/fstab.5
==
--- head/share/man/man5/fstab.5 Thu Oct 11 07:39:51 2012(r241439)
+++ head/share/man/man5/fstab.5 Thu Oct 11 07:54:29 2012(r241440)
@@ -32,7 +32,7 @@
 .\ @(#)fstab.58.1 (Berkeley) 6/5/93
 .\ $FreeBSD$
 .\
-.Dd June 7, 2011
+.Dd October 11, 2012
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -66,12 +66,20 @@ The first field,
 .Pq Fa fs_spec ,
 describes the special device or
 remote file system to be mounted.
+The contents are decoded by the
+.Xr strunvis 3
+function.
+This allows using spaces or tabs in the device name which would be
+interpreted as field separators otherwise.
 .Pp
 The second field,
 .Pq Fa fs_file ,
 describes the mount point for the file system.
 For swap partitions, this field should be specified as
 .Dq none .
+The contents are decoded by the
+.Xr strunvis 3
+function, as above.
 .Pp
 The third field,
 .Pq Fa fs_vfstype ,
@@ -338,6 +346,7 @@ resides in
 .Xr mount 8 ,
 .Xr quotacheck 8 ,
 .Xr quotaon 8 ,
+.Xr strunvis 3 ,
 .Xr swapon 8 ,
 .Xr umount 8
 .Sh HISTORY
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r241441 - head/lib/libc/gen

2012-10-11 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct 11 08:18:28 2012
New Revision: 241441
URL: http://svn.freebsd.org/changeset/base/241441

Log:
  Fix my last commit.  Only call strunvis after properly checking the argument 
is
  not NULL.

Modified:
  head/lib/libc/gen/fstab.c

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Thu Oct 11 07:54:29 2012(r241440)
+++ head/lib/libc/gen/fstab.c   Thu Oct 11 08:18:28 2012(r241441)
@@ -150,16 +150,18 @@ fstabscan(void)
 /* OLD_STYLE_FSTAB */
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
-   if (strunvis(cp, cp)  0)
-   goto bad;
_fs_fstab.fs_spec = cp;
-   if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#')
+   if (_fs_fstab.fs_spec == NULL || *_fs_fstab.fs_spec == '#')
continue;
+   if (strunvis(_fs_fstab.fs_spec, _fs_fstab.fs_spec)  0)
+   goto bad;
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
-   if (strunvis(cp, cp)  0)
-   goto bad;
_fs_fstab.fs_file = cp;
+   if (_fs_fstab.fs_file == NULL)
+   goto bad;
+   if (strunvis(_fs_fstab.fs_file, _fs_fstab.fs_file)  0)
+   goto bad;
fixfsfile();
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r233700 - head/sys/kern

2012-03-30 Thread Stefan Farfeleder
Hi,

here are a few similar cases.

Stefan
Index: tools/regression/lib/libc/nss/test-gethostby.c
===
--- tools/regression/lib/libc/nss/test-gethostby.c	(revision 233700)
+++ tools/regression/lib/libc/nss/test-gethostby.c	(working copy)
@@ -109,7 +109,7 @@
 	else {
 		error = 0;
 		he = getipnodebyname(name, af, ipnode_flags, error);
-		if (he == NULL);
+		if (he == NULL)
 			errno = error;
 	}
 	
Index: cddl/compat/opensolaris/misc/deviceid.c
===
--- cddl/compat/opensolaris/misc/deviceid.c	(revision 233700)
+++ cddl/compat/opensolaris/misc/deviceid.c	(working copy)
@@ -45,7 +45,7 @@
 		return (EINVAL);
 	}
 	*retminor_name = strdup();
-	if (*retminor_name == NULL);
+	if (*retminor_name == NULL)
 		return (ENOMEM);
 	return (0);
 }
Index: sys/sparc64/pci/fire.c
===
--- sys/sparc64/pci/fire.c	(revision 233700)
+++ sys/sparc64/pci/fire.c	(working copy)
@@ -446,7 +446,7 @@
 		FO_PCI_TLU_CTRL_CFG_MASK)  FO_PCI_TLU_CTRL_CFG_SHFT;
 		i = sizeof(fire_freq_nak_tmr_thrs) /
 		sizeof(*fire_freq_nak_tmr_thrs);
-		if (mps = i);
+		if (mps = i)
 			mps = i - 1;
 		FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS,
 		(fire_freq_nak_tmr_thrs[mps][lw] 
Index: sys/contrib/rdma/rdma_addr.c
===
--- sys/contrib/rdma/rdma_addr.c	(revision 233700)
+++ sys/contrib/rdma/rdma_addr.c	(working copy)
@@ -172,7 +172,7 @@
 	*dst = *dst_in;
 
 	rtalloc(iproute);
-	if (iproute.ro_rt == NULL);
+	if (iproute.ro_rt == NULL)
 		return;
 
 	arpresolve(iproute.ro_rt-rt_ifp, iproute.ro_rt, NULL, 
Index: sys/dev/gpio/gpioc.c
===
--- sys/dev/gpio/gpioc.c	(revision 233700)
+++ sys/dev/gpio/gpioc.c	(working copy)
@@ -102,7 +102,7 @@
 	struct gpioc_softc *sc = device_get_softc(dev);
 	int err;
 
-	if (sc-sc_ctl_dev);
+	if (sc-sc_ctl_dev)
 		destroy_dev(sc-sc_ctl_dev);
 
 	if ((err = bus_generic_detach(dev)) != 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r232857 - head/libexec/rtld-elf

2012-03-12 Thread Stefan Farfeleder
On Mon, Mar 12, 2012 at 11:04:48AM +, Dimitry Andric wrote:
 Modified: head/libexec/rtld-elf/rtld.c
 ==
 --- head/libexec/rtld-elf/rtld.c  Mon Mar 12 10:36:03 2012
 (r232856)
 +++ head/libexec/rtld-elf/rtld.c  Mon Mar 12 11:04:48 2012
 (r232857)
 @@ -1895,7 +1895,7 @@ preinit_main(void)
  int index;
  
  preinit_addr = (Elf_Addr *)obj_main-preinit_array;
 -if (preinit_addr == (Elf_Addr)NULL)
 +if (preinit_addr == (Elf_Addr *)NULL)
   return;
  
  for (index = 0; index  obj_main-preinit_array_num; index++) {
 @@ -2036,7 +2036,7 @@ objlist_call_init(Objlist *list, RtldLoc
   call_initfini_pointer(elm-obj, elm-obj-init);
   }
   init_addr = (Elf_Addr *)elm-obj-init_array;
 - if (init_addr != (Elf_Addr)NULL) {
 + if (init_addr != (Elf_Addr *)NULL) {
   for (index = 0; index  elm-obj-init_array_num; index++) {
   if (init_addr[index] != 0  init_addr[index] != 1) {
   dbg(calling init function for %s at %p, elm-obj-path,
 

Why don't you simply remove the unnecessary casts?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Stefan Farfeleder
On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote:
 On Thursday, January 26, 2012 10:56:27 am Andrey Chernov wrote:
   On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote:
atomic_cmpset_int(iniseed_state, ARC4_ENTER_NONE, 
 ARC4_ENTER_HAVE);
break;
  
  Updated version (I hope, final):
  
  --- sys/libkern.h.old   2012-01-16 07:15:12.0 +0400
  +++ sys/libkern.h   2012-01-26 19:38:06.0 +0400
  @@ -72,6 +72,8 @@ static __inline quad_t qabs(quad_t a) { 
   
   /* Prototypes for non-quad routines. */
   struct malloc_type;
  +enum   arc4_is { ARC4_ENTR_NONE, ARC4_ENTR_HAVE, ARC4_ENTR_DONE };
  +extern volatile enum arc4_is arc4rand_iniseed_state;
 
 Atomics don't operate on enums.  You'll need to make it an int and just use 
 #define's for the 3 states.

The type of an enumerator actually is `int', so it should be fine.
 
   uint32_t arc4random(void);
   voidarc4rand(void *ptr, u_int len, int reseed);
   int bcmp(const void *, const void *, size_t);
  --- dev/random/randomdev_soft.c.old 2011-03-02 01:42:19.0 +0300
  +++ dev/random/randomdev_soft.c 2012-01-26 19:35:12.0 +0400
  @@ -366,6 +366,8 @@ random_yarrow_unblock(void)
  selwakeuppri(random_systat.rsel, PUSER);
  wakeup(random_systat);
  }
  +   (void)atomic_cmpset_int(arc4rand_iniseed_state,
  +   ARC4_ENTR_NONE, ARC4_ENTR_HAVE);
   }

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Stefan Farfeleder
On Thu, Jan 26, 2012 at 06:34:13PM +0100, Stefan Farfeleder wrote:
 
 The type of an enumerator actually is `int', so it should be fine.

Please ignore that, I misread the diff.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230546 - head/usr.bin/bc

2012-01-25 Thread Stefan Farfeleder
Author: stefanf
Date: Wed Jan 25 18:49:11 2012
New Revision: 230546
URL: http://svn.freebsd.org/changeset/base/230546

Log:
  Remove extra sentence, a leftover from r202845.

Modified:
  head/usr.bin/bc/bc.1

Modified: head/usr.bin/bc/bc.1
==
--- head/usr.bin/bc/bc.1Wed Jan 25 18:36:01 2012(r230545)
+++ head/usr.bin/bc/bc.1Wed Jan 25 18:49:11 2012(r230546)
@@ -82,8 +82,6 @@ Prints usage information.
 Allow specification of an arbitrary precision math library.
 The definitions in the library are available to command line
 expressions.
-Synonym for
-.Fl l .
 .It Fl v , Fl Fl version
 Prints version information.
 .El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230464 - head/share/man/man4

2012-01-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Jan 22 14:04:42 2012
New Revision: 230464
URL: http://svn.freebsd.org/changeset/base/230464

Log:
  Document the values for hw.snd.default_auto.

Modified:
  head/share/man/man4/pcm.4

Modified: head/share/man/man4/pcm.4
==
--- head/share/man/man4/pcm.4   Sun Jan 22 14:00:33 2012(r230463)
+++ head/share/man/man4/pcm.4   Sun Jan 22 14:04:42 2012(r230464)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd July 31, 2011
+.Dd January 22, 2012
 .Dt SOUND 4
 .Os
 .Sh NAME
@@ -324,8 +324,17 @@ for Linux applications, and deny for eve
 Always allow PROT_EXEC page mappings.
 .El
 .It Va hw.snd.default_auto
-Enable to automatically assign default sound unit to the most recent
-attached device.
+Automatically assign the default sound unit.
+The following values are supported (default is 1):
+.Bl -tag -width 2n
+.It 0
+Do not assign the default sound unit automatically.
+.It 1
+Use the best available sound device based on playing and recording
+capabilities of the device.
+.It 2
+Use the most recently attached device.
+.El
 .It Va hw.snd.default_unit
 Default sound card for systems with multiple sound cards.
 When using
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230310 - stable/8/contrib/gcc/config/i386

2012-01-18 Thread Stefan Farfeleder
Author: stefanf
Date: Wed Jan 18 18:22:25 2012
New Revision: 230310
URL: http://svn.freebsd.org/changeset/base/230310

Log:
  MFC r226430:
  Adjust posix_memalign() prototype to match what we define in stdlib.h for
  C++ compilation.

Modified:
  stable/8/contrib/gcc/config/i386/pmm_malloc.h
Directory Properties:
  stable/8/contrib/gcc/   (props changed)

Modified: stable/8/contrib/gcc/config/i386/pmm_malloc.h
==
--- stable/8/contrib/gcc/config/i386/pmm_malloc.h   Wed Jan 18 15:59:23 
2012(r230309)
+++ stable/8/contrib/gcc/config/i386/pmm_malloc.h   Wed Jan 18 18:22:25 
2012(r230310)
@@ -34,7 +34,7 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
-extern C int posix_memalign (void **, size_t, size_t) throw ();
+extern C int posix_memalign (void **, size_t, size_t);
 #endif
 
 static __inline void *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r229075 - head/usr.sbin/bluetooth/hccontrol

2011-12-31 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Dec 31 12:12:41 2011
New Revision: 229075
URL: http://svn.freebsd.org/changeset/base/229075

Log:
  Fix typos in command descriptions.

Modified:
  head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c

Modified: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
==
--- head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cSat Dec 
31 11:43:35 2011(r229074)
+++ head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cSat Dec 
31 12:12:41 2011(r229075)
@@ -1633,7 +1633,7 @@ struct hci_commandhost_controller_baseb
 defines the amount of time for the duration of the page scan. \n \
 The Page_Scan_Window can only be less than or equal to the 
Page_Scan_Interval.\n\n \
 \tinterval - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n \
-\twindow   - Range: 0x0012 -- 0x100, Time = N * 0.625 msen,
+\twindow   - Range: 0x0012 -- 0x100, Time = N * 0.625 msec,
 hci_write_page_scan_activity
 },
 {
@@ -1655,7 +1655,7 @@ struct hci_commandhost_controller_baseb
 parameter defines the amount of time for the duration of the inquiry scan.\n 
\
 The Inquiry_Scan_Window can only be less than or equal to the 
Inquiry_Scan_Interval.\n\n \
 \tinterval - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n \
-\twindow   - Range: 0x0012 -- 0x100, Time = N * 0.625 msen,
+\twindow   - Range: 0x0012 -- 0x100, Time = N * 0.625 msec,
 hci_write_inquiry_scan_activity
 },
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r229123 - stable/9/contrib/gcc/config/i386

2011-12-31 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Dec 31 15:49:04 2011
New Revision: 229123
URL: http://svn.freebsd.org/changeset/base/229123

Log:
  MFC r226430:
  Adjust posix_memalign() prototype to match what we define in stdlib.h for
  C++ compilation.

Modified:
  stable/9/contrib/gcc/config/i386/pmm_malloc.h
Directory Properties:
  stable/9/contrib/gcc/   (props changed)

Modified: stable/9/contrib/gcc/config/i386/pmm_malloc.h
==
--- stable/9/contrib/gcc/config/i386/pmm_malloc.h   Sat Dec 31 15:46:36 
2011(r229122)
+++ stable/9/contrib/gcc/config/i386/pmm_malloc.h   Sat Dec 31 15:49:04 
2011(r229123)
@@ -34,7 +34,7 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
-extern C int posix_memalign (void **, size_t, size_t) throw ();
+extern C int posix_memalign (void **, size_t, size_t);
 #endif
 
 static __inline void *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228471 - in head/sys: boot/arm/at91/libat91 dev/cm dev/de dev/fdc dev/pccard dev/spibus dev/xen/netback pc98/cbus

2011-12-13 Thread Stefan Farfeleder
On Tue, Dec 13, 2011 at 02:06:01PM +, Ed Schouten wrote:
 Author: ed
 Date: Tue Dec 13 14:06:01 2011
 New Revision: 228471
 URL: http://svn.freebsd.org/changeset/base/228471
 
 Log:
   Replace `inline static' by `static inline'.
   
   If I interpret the C standard correctly, the storage specifier should be
   placed before the inline keyword. While at it, replace __inline by
   inline in the files affected.

No, declaration-specifier is defined recursively - any order is allowed.
Still I think having a consistent order is a good idea.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys

2011-12-07 Thread Stefan Farfeleder
On Wed, Dec 07, 2011 at 03:25:48PM +, David Chisnall wrote:
  
  /*
 + * If we're in a mode greater than C99, expose C1x functions.
 + */
 +#if __ISO_C_VISIBLE  1999
 +__noreturn void quick_exit(int)
 +int
 +at_quick_exit(void (*func)(void));
 +#endif /* __ISO_C_VISIBLE  1999 */
 +/*
   * Extensions made by POSIX relative to C.  We don't know yet which edition

Shouldn't it be visible in the default mode too (__BSD_VISIBLE)?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r227369 - head/bin/sh

2011-11-09 Thread Stefan Farfeleder
On Tue, Nov 08, 2011 at 11:54:39PM +, Jilles Tjoelker wrote:
 Author: jilles
 Date: Tue Nov  8 23:54:39 2011
 New Revision: 227369
 URL: http://svn.freebsd.org/changeset/base/227369
 
 Log:
   sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.
   
   With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.
 
 Modified:
   head/bin/sh/arith_yacc.c
 
 Modified: head/bin/sh/arith_yacc.c
 ==
 --- head/bin/sh/arith_yacc.c  Tue Nov  8 23:44:26 2011(r227368)
 +++ head/bin/sh/arith_yacc.c  Tue Nov  8 23:54:39 2011(r227369)
 @@ -131,11 +131,11 @@ static arith_t do_binop(int op, arith_t 
   yyerror(divide error);
   return op == ARITH_REM ? a % b : a / b;
   case ARITH_MUL:
 - return a * b;
 + return (uintmax_t)a * (uintmax_t)b;
   case ARITH_ADD:
 - return a + b;
 + return (uintmax_t)a + (uintmax_t)b;
   case ARITH_SUB:
 - return a - b;
 + return (uintmax_t)a - (uintmax_t)b;
   case ARITH_LSHIFT:
   return a  b;
   case ARITH_RSHIFT:
 

Isn't the behaviour undefined too when you convert an out-of-range
uintmax_t value back into an intmax_t value?

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r226430 - head/contrib/gcc/config/i386

2011-10-16 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Oct 16 10:14:33 2011
New Revision: 226430
URL: http://svn.freebsd.org/changeset/base/226430

Log:
  Adjust posix_memalign() prototype to match what we define in stdlib.h for
  C++ compilation.
  
  PR:   standards/147210

Modified:
  head/contrib/gcc/config/i386/pmm_malloc.h

Modified: head/contrib/gcc/config/i386/pmm_malloc.h
==
--- head/contrib/gcc/config/i386/pmm_malloc.h   Sun Oct 16 10:00:28 2011
(r226429)
+++ head/contrib/gcc/config/i386/pmm_malloc.h   Sun Oct 16 10:14:33 2011
(r226430)
@@ -34,7 +34,7 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
-extern C int posix_memalign (void **, size_t, size_t) throw ();
+extern C int posix_memalign (void **, size_t, size_t);
 #endif
 
 static __inline void *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r226430 - head/contrib/gcc/config/i386

2011-10-16 Thread Stefan Farfeleder
On Sun, Oct 16, 2011 at 12:25:14PM +0200, Roman Divacky wrote:
 Can this be MFCed to stable/9 ? I've seen clang erroring out
 because of this quite a lot.

Yes I think so.

Stefan

 On Sun, Oct 16, 2011 at 10:14:33AM +, Stefan Farfeleder wrote:
  Author: stefanf
  Date: Sun Oct 16 10:14:33 2011
  New Revision: 226430
  URL: http://svn.freebsd.org/changeset/base/226430
  
  Log:
Adjust posix_memalign() prototype to match what we define in stdlib.h for
C++ compilation.

PR:   standards/147210
  
  Modified:
head/contrib/gcc/config/i386/pmm_malloc.h
  
  Modified: head/contrib/gcc/config/i386/pmm_malloc.h
  ==
  --- head/contrib/gcc/config/i386/pmm_malloc.h   Sun Oct 16 10:00:28 
  2011(r226429)
  +++ head/contrib/gcc/config/i386/pmm_malloc.h   Sun Oct 16 10:14:33 
  2011(r226430)
  @@ -34,7 +34,7 @@
   #ifndef __cplusplus
   extern int posix_memalign (void **, size_t, size_t);
   #else
  -extern C int posix_memalign (void **, size_t, size_t) throw ();
  +extern C int posix_memalign (void **, size_t, size_t);
   #endif
   
   static __inline void *
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r223138 - head/sys/ufs/ffs

2011-06-16 Thread Stefan Farfeleder
On Thu, Jun 16, 2011 at 05:26:03AM +, Tai-hwa Liang wrote:
 Author: avatar
 Date: Thu Jun 16 05:26:03 2011
 New Revision: 223138
 URL: http://svn.freebsd.org/changeset/base/223138
 
 Log:
   Fixing compilation bustage by introducing another forward declaration.
 
 Modified:
   head/sys/ufs/ffs/ffs_extern.h
 
 Modified: head/sys/ufs/ffs/ffs_extern.h
 ==
 --- head/sys/ufs/ffs/ffs_extern.h Thu Jun 16 02:27:05 2011
 (r223137)
 +++ head/sys/ufs/ffs/ffs_extern.h Thu Jun 16 05:26:03 2011
 (r223138)
 @@ -33,6 +33,7 @@
  #ifndef _UFS_FFS_EXTERN_H
  #define  _UFS_FFS_EXTERN_H
  
 +enum vtype;
  struct buf;
  struct cg;
  struct fid;
 

This is not valid C code. For some reason GCC allows it (with our
compilation flags).

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r221972 - head/sys/geom/part

2011-05-22 Thread Stefan Farfeleder
On Sun, May 15, 2011 at 08:03:55PM +, Andrey V. Elsukov wrote:
 Author: ae
 Date: Sun May 15 20:03:54 2011
 New Revision: 221972
 URL: http://svn.freebsd.org/changeset/base/221972
 
 Log:
   Add a sysctl kern.geom.part.check_integrity for those who has corrupt
   partition tables and lost an ability to boot after r221788.
   Also unhide an error message from bootverbose, this would help to
   easier determine the problem.

So, what's the point of this check? It breaks mounting of all my USB
drives.  Everyone now has to set this sysctl?

da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
da0: Kingston DT 101 G2 PMAP Removable Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: 15304MB (31342592 512 byte sectors: 255H 63S/T 1950C)
GEOM_PART: integrity check failed (da0, MBR)

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r219363 - head/bin/sh

2011-03-06 Thread Stefan Farfeleder
Author: stefanf
Date: Mon Mar  7 07:31:15 2011
New Revision: 219363
URL: http://svn.freebsd.org/changeset/base/219363

Log:
  Remove unnecessary cast.
  
  Reviewed by:  jilles

Modified:
  head/bin/sh/arith_yylex.c

Modified: head/bin/sh/arith_yylex.c
==
--- head/bin/sh/arith_yylex.c   Mon Mar  7 03:15:49 2011(r219362)
+++ head/bin/sh/arith_yylex.c   Mon Mar  7 07:31:15 2011(r219363)
@@ -80,7 +80,7 @@ yylex()
case '7':
case '8':
case '9':
-   yylval.val = strtoarith_t(buf, (char **)end, 0);
+   yylval.val = strtoarith_t(buf, end, 0);
arith_buf = end;
return ARITH_NUM;
case 'A':
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r216616 - in head/sys: kern sys

2010-12-21 Thread Stefan Farfeleder
On Tue, Dec 21, 2010 at 04:29:58PM +, Matthew D Fleming wrote:
 Author: mdf
 Date: Tue Dec 21 16:29:58 2010
 New Revision: 216616
 URL: http://svn.freebsd.org/changeset/base/216616
 
 Log:
   Move the fail_point_entry definition from fail.h to kern_fail.c, which
   allows putting the enumeration constants of fail point types with the
   text string that matches them.

[snip]

 +enum fail_point_t {
 + FAIL_POINT_OFF, /** don't fail */
 + FAIL_POINT_PANIC,   /** panic */
 + FAIL_POINT_RETURN,  /** return an errorcode */
 + FAIL_POINT_BREAK,   /** break into the debugger */
 + FAIL_POINT_PRINT,   /** print a message */
 + FAIL_POINT_SLEEP,   /** sleep for some msecs */
 + FAIL_POINT_INVALID, /** placeholder */
 +};
 +
 +static const char *fail_type_strings[] = {
 + off,
 + panic,
 + return,
 + break,
 + print,
 + sleep,
 +};

FWIW, you can also do this in C99:

static const char *fail_type_strings[] = {
[FAIL_POINT_OFF] = off,
};

Cheers,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r215612 - stable/8/sys/net80211

2010-11-21 Thread Stefan Farfeleder
On Sun, Nov 21, 2010 at 10:49:41AM +, Bernhard Schmidt wrote:
 Author: bschmidt
 Date: Sun Nov 21 10:49:40 2010
 New Revision: 215612
 URL: http://svn.freebsd.org/changeset/base/215612
 
 Log:
   Compare the address of the array, not the array.
   
   Committed by:   rpaulo
   Found with: Coverity Prevent(tm)
   CID:3690

This doesn't make sense to me. How can the address of the array member
be null? Also comparing the array and comparing its address has the same
effect as the array is converted to the pointer anyway in the context of
the comparison.

Stefan

 Modified:
   stable/8/sys/net80211/ieee80211_scan_sta.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
 
 Modified: stable/8/sys/net80211/ieee80211_scan_sta.c
 ==
 --- stable/8/sys/net80211/ieee80211_scan_sta.cSun Nov 21 10:45:10 
 2010(r215611)
 +++ stable/8/sys/net80211/ieee80211_scan_sta.cSun Nov 21 10:49:40 
 2010(r215612)
 @@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap,
*/
   if (se-se_capinfo  
 (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS))
   fail |= MATCH_CAPINFO;
 - else if (se-se_meshid == NULL)
 + else if (se-se_meshid == NULL)
   fail |= MATCH_MESH_NOID;
   else if (ms-ms_idlen != 0 
   match_id(se-se_meshid, ms-ms_id, ms-ms_idlen))
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r213769 - head/sys/geom/part

2010-10-13 Thread Stefan Farfeleder
On Wed, Oct 13, 2010 at 11:35:59AM +, Rui Paulo wrote:
 Author: rpaulo
 Date: Wed Oct 13 11:35:59 2010
 New Revision: 213769
 URL: http://svn.freebsd.org/changeset/base/213769
 
 Log:
   The canonical way to print __func__ when using KASSERT() is to write
   (%s, __func__). This avoids clang's -Wformat-string warnings.
 

That's a stupid warning, clang should know the value of __func__.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r212804 - head/sys/boot/zfs

2010-09-18 Thread Stefan Farfeleder
Um, was the change from 32 to 31 deliberate?

On Fri, Sep 17, 2010 at 10:51:45PM +, Pawel Jakub Dawidek wrote:
 Author: pjd
 Date: Fri Sep 17 22:51:45 2010
 New Revision: 212804
 URL: http://svn.freebsd.org/changeset/base/212804
 
 Log:
   Remove magic value.
 
 Modified:
   head/sys/boot/zfs/zfs.c
 
 Modified: head/sys/boot/zfs/zfs.c
 ==
 --- head/sys/boot/zfs/zfs.c   Fri Sep 17 22:05:27 2010(r212803)
 +++ head/sys/boot/zfs/zfs.c   Fri Sep 17 22:51:45 2010(r212804)
 @@ -45,6 +45,8 @@ __FBSDID($FreeBSD$);
  
  #include zfsimpl.c
  
 +#define  MAXBDDEV31
 +
  static int   zfs_open(const char *path, struct open_file *f);
  static int   zfs_write(struct open_file *f, void *buf, size_t size, size_t 
 *resid);
  static int   zfs_close(struct open_file *f);
 @@ -402,7 +404,7 @@ zfs_dev_init(void) 
* diskN, diskNpM or diskNsM.
*/
   zfs_init();
 - for (unit = 0; unit  32 /* XXX */; unit++) {
 + for (unit = 0; unit  MAXBDDEV; unit++) {
   sprintf(devname, disk%d:, unit);
   fd = open(devname, O_RDONLY);
   if (fd == -1)
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r211130 - head/libexec/rtld-elf/mips

2010-08-10 Thread Stefan Farfeleder
On Tue, Aug 10, 2010 at 05:15:35AM +, Neel Natu wrote:
 Author: neel
 Date: Tue Aug 10 05:15:35 2010
 New Revision: 211130
 URL: http://svn.freebsd.org/changeset/base/211130
 
 Log:
   Fix compilation error for 64-bit little endian build:
   libexec/rtld-elf/mips/reloc.c:196: warning: right shift count = width of 
 type
   
   When the expression '(r_info)  32' was passed to bswap32() it was promptly
   changed to '(uint32_t)(r_info)  32' which is not what we intended.

Wouldn't it be better to fix the bswap32 macro instead?

 Modified:
   head/libexec/rtld-elf/mips/reloc.c
 
 Modified: head/libexec/rtld-elf/mips/reloc.c
 ==
 --- head/libexec/rtld-elf/mips/reloc.cMon Aug  9 23:32:37 2010
 (r211129)
 +++ head/libexec/rtld-elf/mips/reloc.cTue Aug 10 05:15:35 2010
 (r211130)
 @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
   * ELF64 MIPS encodes the relocs uniquely.  The first 32-bits of info contain
   * the symbol index.  The top 32-bits contain three relocation types encoded
   * in big-endian integer with first relocation in LSB.  This means for little
 - * endian we have to byte swap that interger (r_type).
 + * endian we have to byte swap that integer (r_type).
   */
  #define  Elf_Sxword  Elf64_Sxword
  #define  ELF_R_NXTTYPE_64_P(r_type)  r_type)  8)  0xff) == 
 R_TYPE(64))
 @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
  #undef ELF_R_SYM
  #undef ELF_R_TYPE
  #define ELF_R_SYM(r_info)((r_info)  0x)
 -#define ELF_R_TYPE(r_info)   bswap32((r_info)  32)
 +#define ELF_R_TYPE(r_info)   bswap32(((r_info)  32))
  #endif
  #else
  #define  ELF_R_NXTTYPE_64_P(r_type)  (0)
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r211130 - head/libexec/rtld-elf/mips

2010-08-10 Thread Stefan Farfeleder
On Tue, Aug 10, 2010 at 12:55:38PM +0530, Jayachandran C. wrote:
 
 I think there is a problem in  sys/mips/include/_endian.h
 --
 #define __bswap16(x)(__uint16_t)(__is_constant(x) ? \
 __bswap16_const((__uint16_t)x) :  __bswap16_var((__uint16_t)x))
 #define __bswap32(x)(__uint32_t)(__is_constant(x) ? \
 __bswap32_const((__uint32_t)x) :  __bswap32_var((__uint32_t)x))
 #define __bswap64(x)(__uint64_t)(__is_constant(x) ? \
 __bswap64_const((__uint64_t)x) :  __bswap64_var((__uint64_t)x))
 --
 
 I'm not sure why the cast is needed, but we should have a braces
 around x, unless I'm completely mistaken.

I agree. And around the entire expression too.

Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r210941 - head/share/man/man9

2010-08-06 Thread Stefan Farfeleder
Author: stefanf
Date: Fri Aug  6 16:50:48 2010
New Revision: 210941
URL: http://svn.freebsd.org/changeset/base/210941

Log:
  Add links for destroy_dev_drain, destroy_dev_sched, destroy_dev_sched_cb,
  make_dev_cred and make_dev_credf.

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri Aug  6 15:59:00 2010
(r210940)
+++ head/share/man/man9/MakefileFri Aug  6 16:50:48 2010
(r210941)
@@ -769,8 +769,13 @@ MLINKS+=lock.9 lockdestroy.9 \
lock.9 lockstatus.9
 MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
 MLINKS+=make_dev.9 destroy_dev.9 \
+   make_dev.9 destroy_dev_drain.9 \
+   make_dev.9 destroy_dev_sched.9 \
+   make_dev.9 destroy_dev_sched_cb.9 \
make_dev.9 dev_depends.9 \
-   make_dev.9 make_dev_alias.9
+   make_dev.9 make_dev_alias.9 \
+   make_dev.9 make_dev_cred.9 \
+   make_dev.9 make_dev_credf.9
 MLINKS+=malloc.9 free.9 \
malloc.9 MALLOC_DECLARE.9 \
malloc.9 MALLOC_DEFINE.9 \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r210498 - in head/sys: compat/freebsd32 sys

2010-07-26 Thread Stefan Farfeleder
On Mon, Jul 26, 2010 at 12:52:45PM +, Konstantin Belousov wrote:
 Author: kib
 Date: Mon Jul 26 12:52:44 2010
 New Revision: 210498
 URL: http://svn.freebsd.org/changeset/base/210498
 
 Log:
   Revert r210451, and the similar part of the r210431. The forward-declaration
   for the enum tag when enum definition is not complete is not allowed by
   C99, and is gcc extension.
   
   Requested by:   stefanf
   MFC after:  28 days

Thank you.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r209119 - head/sys/sys

2010-06-13 Thread Stefan Farfeleder
On Sun, Jun 13, 2010 at 01:59:11PM +, m...@freebsd.org wrote:
 
 (Relevant but almost a thread hijack):
 
 At Isilon we've run into a lot of problems with variable declarations
 in macros, especially with -Wshadow turned on.  We ended up
 backporting __COUNTER__ from later versions of gcc and then using it
 to make unique variable names.
 
  - is the backport (or a fresh implementation) something that could be
 done within the scope of the GPL license?
  - is it something FreeBSD would be interested in?
  - is __COUNTER__ supported by clang?
  - if not, could it be?
 
 -Wshadow found several nasty bugs in our code, and apart from a few
 spurious warnings it has been handy to have when building our
 filesystem.

In my opinion using non-standard C features just to work around warnings
is a bit questionable.  A more useful feature would be an attribute that
avoids -Wshadow warnings.

Regards,
Stefan
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208380 - stable/8/tools/regression/bin/sh/builtins

2010-05-21 Thread Stefan Farfeleder
Author: stefanf
Date: Fri May 21 16:01:57 2010
New Revision: 208380
URL: http://svn.freebsd.org/changeset/base/208380

Log:
  Merge r199628 and r199632: Tests for the cd command.

Added:
  stable/8/tools/regression/bin/sh/builtins/cd2.0
 - copied unchanged from r199632, 
head/tools/regression/bin/sh/builtins/cd2.0
Modified:
  stable/8/tools/regression/bin/sh/builtins/cd1.0
Directory Properties:
  stable/8/tools/regression/bin/sh/   (props changed)

Modified: stable/8/tools/regression/bin/sh/builtins/cd1.0
==
--- stable/8/tools/regression/bin/sh/builtins/cd1.0 Fri May 21 15:57:24 
2010(r208379)
+++ stable/8/tools/regression/bin/sh/builtins/cd1.0 Fri May 21 16:01:57 
2010(r208380)
@@ -1,17 +1,27 @@
 # $FreeBSD$
 set -e
 
-PDIR=${TMPDIR:-/tmp}
-cd ${PDIR}
-TMPDIR=$(mktemp -d sh-test.XX)
-chmod 0 ${TMPDIR}
+P=${TMPDIR:-/tmp}
+cd $P
+T=$(mktemp -d sh-test.XX)
 
-cd -L ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
-cd -P ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
+chmod 0 $T
+cd -L $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
+cd -P $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
 
-chmod 755 ${TMPDIR}
-rmdir ${TMPDIR}
+chmod 755 $T
+cd $T
+mkdir -p 1/2/3
+ln -s 1/2 link1
+ln -s 2/3 1/link2
+(cd -L 1/../1  [ $(pwd -L) = $P/$T/1 ])
+(cd -L link1  [ $(pwd -L) = $P/$T/link1 ])
+(cd -L link1  [ $(pwd -P) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -L) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -P) = $P/$T/1/2 ])
+
+rm -rf ${P}/${T}

Copied: stable/8/tools/regression/bin/sh/builtins/cd2.0 (from r199632, 
head/tools/regression/bin/sh/builtins/cd2.0)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/builtins/cd2.0 Fri May 21 16:01:57 
2010(r208380, copy of r199632, 
head/tools/regression/bin/sh/builtins/cd2.0)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+set -e
+
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XX)
+cd $T
+D=$T
+for i in 0 1 2 3 4 5 6 7 8 9; do
+   for j in 0 1 2 3 4 5 6 7 8 9; do
+   mkdir veryverylongdirectoryname
+   cd veryverylongdirectoryname
+   D=$D/veryverylongdirectoryname
+   done
+done
+[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
+rm -rf ${T}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208386 - stable/7/tools/regression/bin/sh/builtins

2010-05-21 Thread Stefan Farfeleder
Author: stefanf
Date: Fri May 21 16:25:16 2010
New Revision: 208386
URL: http://svn.freebsd.org/changeset/base/208386

Log:
  Merge r199628 and r199632: Tests for the cd command.

Added:
  stable/7/tools/regression/bin/sh/builtins/cd1.0
 - copied, changed from r176522, head/tools/regression/bin/sh/builtins/cd1.0
  stable/7/tools/regression/bin/sh/builtins/cd2.0
 - copied unchanged from r199632, 
head/tools/regression/bin/sh/builtins/cd2.0
Modified:
Directory Properties:
  stable/7/tools/regression/bin/sh/   (props changed)

Copied and modified: stable/7/tools/regression/bin/sh/builtins/cd1.0 (from 
r176522, head/tools/regression/bin/sh/builtins/cd1.0)
==
--- head/tools/regression/bin/sh/builtins/cd1.0 Sun Feb 24 16:52:02 2008
(r176522, copy source)
+++ stable/7/tools/regression/bin/sh/builtins/cd1.0 Fri May 21 16:25:16 
2010(r208386)
@@ -1,17 +1,27 @@
 # $FreeBSD$
 set -e
 
-PDIR=${TMPDIR:-/tmp}
-cd ${PDIR}
-TMPDIR=$(mktemp -d sh-test.XX)
-chmod 0 ${TMPDIR}
+P=${TMPDIR:-/tmp}
+cd $P
+T=$(mktemp -d sh-test.XX)
 
-cd -L ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
-cd -P ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
+chmod 0 $T
+cd -L $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
+cd -P $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
 
-chmod 755 ${TMPDIR}
-rmdir ${TMPDIR}
+chmod 755 $T
+cd $T
+mkdir -p 1/2/3
+ln -s 1/2 link1
+ln -s 2/3 1/link2
+(cd -L 1/../1  [ $(pwd -L) = $P/$T/1 ])
+(cd -L link1  [ $(pwd -L) = $P/$T/link1 ])
+(cd -L link1  [ $(pwd -P) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -L) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -P) = $P/$T/1/2 ])
+
+rm -rf ${P}/${T}

Copied: stable/7/tools/regression/bin/sh/builtins/cd2.0 (from r199632, 
head/tools/regression/bin/sh/builtins/cd2.0)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/builtins/cd2.0 Fri May 21 16:25:16 
2010(r208386, copy of r199632, 
head/tools/regression/bin/sh/builtins/cd2.0)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+set -e
+
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XX)
+cd $T
+D=$T
+for i in 0 1 2 3 4 5 6 7 8 9; do
+   for j in 0 1 2 3 4 5 6 7 8 9; do
+   mkdir veryverylongdirectoryname
+   cd veryverylongdirectoryname
+   D=$D/veryverylongdirectoryname
+   done
+done
+[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
+rm -rf ${T}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208387 - in stable/7/tools/regression/bin/sh: builtins set-e

2010-05-21 Thread Stefan Farfeleder
Author: stefanf
Date: Fri May 21 16:32:14 2010
New Revision: 208387
URL: http://svn.freebsd.org/changeset/base/208387

Log:
  Merge r193178 and r194897: Tests for the eval command.

Added:
  stable/7/tools/regression/bin/sh/builtins/eval1.0
 - copied unchanged from r193178, 
head/tools/regression/bin/sh/builtins/eval1.0
  stable/7/tools/regression/bin/sh/builtins/eval2.0
 - copied unchanged from r194897, 
head/tools/regression/bin/sh/builtins/eval2.0
  stable/7/tools/regression/bin/sh/set-e/eval1.0
 - copied unchanged from r193178, head/tools/regression/bin/sh/set-e/eval1.0
  stable/7/tools/regression/bin/sh/set-e/eval2.1
 - copied unchanged from r193178, head/tools/regression/bin/sh/set-e/eval2.1
Modified:
  stable/7/tools/regression/bin/sh/set-e/not2.0
Directory Properties:
  stable/7/tools/regression/bin/sh/   (props changed)

Copied: stable/7/tools/regression/bin/sh/builtins/eval1.0 (from r193178, 
head/tools/regression/bin/sh/builtins/eval1.0)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/builtins/eval1.0   Fri May 21 16:32:14 
2010(r208387, copy of r193178, 
head/tools/regression/bin/sh/builtins/eval1.0)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+set -e
+
+eval
+eval  
+eval true
+! eval false
+
+

Copied: stable/7/tools/regression/bin/sh/builtins/eval2.0 (from r194897, 
head/tools/regression/bin/sh/builtins/eval2.0)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/builtins/eval2.0   Fri May 21 16:32:14 
2010(r208387, copy of r194897, 
head/tools/regression/bin/sh/builtins/eval2.0)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+eval '
+false
+
+'  exit 1
+exit 0

Copied: stable/7/tools/regression/bin/sh/set-e/eval1.0 (from r193178, 
head/tools/regression/bin/sh/set-e/eval1.0)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/set-e/eval1.0  Fri May 21 16:32:14 
2010(r208387, copy of r193178, 
head/tools/regression/bin/sh/set-e/eval1.0)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+set -e
+eval false || true

Copied: stable/7/tools/regression/bin/sh/set-e/eval2.1 (from r193178, 
head/tools/regression/bin/sh/set-e/eval2.1)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/set-e/eval2.1  Fri May 21 16:32:14 
2010(r208387, copy of r193178, 
head/tools/regression/bin/sh/set-e/eval2.1)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+set -e
+eval false
+exit 0

Modified: stable/7/tools/regression/bin/sh/set-e/not2.0
==
--- stable/7/tools/regression/bin/sh/set-e/not2.0   Fri May 21 16:25:16 
2010(r208386)
+++ stable/7/tools/regression/bin/sh/set-e/not2.0   Fri May 21 16:32:14 
2010(r208387)
@@ -1,3 +1,4 @@
 # $FreeBSD$
 set -e
 ! false
+! eval false
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208133 - stable/7/bin/sh

2010-05-16 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 16 09:59:28 2010
New Revision: 208133
URL: http://svn.freebsd.org/changeset/base/208133

Log:
  Merge r199631: Handle current work directories of arbitrary length.

Modified:
  stable/7/bin/sh/cd.c
Directory Properties:
  stable/7/bin/sh/   (props changed)

Modified: stable/7/bin/sh/cd.c
==
--- stable/7/bin/sh/cd.cSun May 16 08:03:24 2010(r208132)
+++ stable/7/bin/sh/cd.cSun May 16 09:59:28 2010(r208133)
@@ -70,7 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
-STATIC char *getpwd2(char *, size_t);
+STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;/* current working directory */
 STATIC char *prevdir;  /* previous working directory */
@@ -263,10 +263,8 @@ findcwd(char *dir)
 * any more because we traversed a symbolic link or something
 * we couldn't stat().
 */
-   if (dir == NULL || curdir == NULL)  {
-   p = stalloc(PATH_MAX);
-   return getpwd2(p, PATH_MAX);
-   }
+   if (dir == NULL || curdir == NULL)
+   return getpwd2();
cdcomppath = stalloc(strlen(dir) + 1);
scopy(dir, cdcomppath);
STARTSTACKSTR(new);
@@ -313,7 +311,7 @@ updatepwd(char *dir)
 int
 pwdcmd(int argc, char **argv)
 {
-   char buf[PATH_MAX];
+   char *p;
int ch, phys;
 
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
@@ -341,9 +339,9 @@ pwdcmd(int argc, char **argv)
out1str(curdir);
out1c('\n');
} else {
-   if (getcwd(buf, sizeof(buf)) == NULL)
+   if ((p = getpwd2()) == NULL)
error(.: %s, strerror(errno));
-   out1str(buf);
+   out1str(p);
out1c('\n');
}
 
@@ -356,36 +354,45 @@ pwdcmd(int argc, char **argv)
 char *
 getpwd(void)
 {
-   char buf[PATH_MAX];
char *p;
 
if (curdir)
return curdir;
 
-   p = getpwd2(buf, sizeof(buf));
+   p = getpwd2();
if (p != NULL)
curdir = savestr(p);
 
return curdir;
 }
 
+#define MAXPWD 256
+
 /*
  * Return the current directory.
  */
 STATIC char *
-getpwd2(char *buf, size_t size)
+getpwd2(void)
 {
-   if (getcwd(buf, size) == NULL) {
-   char *pwd = getenv(PWD);
-   struct stat stdot, stpwd;
-
-   if (pwd  *pwd == '/'  stat(., stdot) != -1 
-   stat(pwd, stpwd) != -1 
-   stdot.st_dev == stpwd.st_dev 
-   stdot.st_ino == stpwd.st_ino) {
+   struct stat stdot, stpwd;
+   char *pwd;
+   int i;
+
+   for (i = MAXPWD;; i *= 2) {
+   pwd = stalloc(i);
+   if (getcwd(pwd, i) != NULL)
return pwd;
-   }
-   return NULL;
+   stunalloc(pwd);
+   if (errno != ERANGE)
+   break;
+   }
+
+   pwd = getenv(PWD);
+   if (pwd  *pwd == '/'  stat(., stdot) != -1 
+   stat(pwd, stpwd) != -1 
+   stdot.st_dev == stpwd.st_dev 
+   stdot.st_ino == stpwd.st_ino) {
+   return pwd;
}
-   return buf;
+   return NULL;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208134 - stable/8/bin/sh

2010-05-16 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 16 10:01:06 2010
New Revision: 208134
URL: http://svn.freebsd.org/changeset/base/208134

Log:
  Merge r199631: Handle current work directories of arbitrary length.

Modified:
  stable/8/bin/sh/cd.c
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/cd.c
==
--- stable/8/bin/sh/cd.cSun May 16 09:59:28 2010(r208133)
+++ stable/8/bin/sh/cd.cSun May 16 10:01:06 2010(r208134)
@@ -70,7 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
-STATIC char *getpwd2(char *, size_t);
+STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;/* current working directory */
 STATIC char *prevdir;  /* previous working directory */
@@ -263,10 +263,8 @@ findcwd(char *dir)
 * any more because we traversed a symbolic link or something
 * we couldn't stat().
 */
-   if (dir == NULL || curdir == NULL)  {
-   p = stalloc(PATH_MAX);
-   return getpwd2(p, PATH_MAX);
-   }
+   if (dir == NULL || curdir == NULL)
+   return getpwd2();
cdcomppath = stalloc(strlen(dir) + 1);
scopy(dir, cdcomppath);
STARTSTACKSTR(new);
@@ -313,7 +311,7 @@ updatepwd(char *dir)
 int
 pwdcmd(int argc, char **argv)
 {
-   char buf[PATH_MAX];
+   char *p;
int ch, phys;
 
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
@@ -341,9 +339,9 @@ pwdcmd(int argc, char **argv)
out1str(curdir);
out1c('\n');
} else {
-   if (getcwd(buf, sizeof(buf)) == NULL)
+   if ((p = getpwd2()) == NULL)
error(.: %s, strerror(errno));
-   out1str(buf);
+   out1str(p);
out1c('\n');
}
 
@@ -356,36 +354,45 @@ pwdcmd(int argc, char **argv)
 char *
 getpwd(void)
 {
-   char buf[PATH_MAX];
char *p;
 
if (curdir)
return curdir;
 
-   p = getpwd2(buf, sizeof(buf));
+   p = getpwd2();
if (p != NULL)
curdir = savestr(p);
 
return curdir;
 }
 
+#define MAXPWD 256
+
 /*
  * Return the current directory.
  */
 STATIC char *
-getpwd2(char *buf, size_t size)
+getpwd2(void)
 {
-   if (getcwd(buf, size) == NULL) {
-   char *pwd = getenv(PWD);
-   struct stat stdot, stpwd;
-
-   if (pwd  *pwd == '/'  stat(., stdot) != -1 
-   stat(pwd, stpwd) != -1 
-   stdot.st_dev == stpwd.st_dev 
-   stdot.st_ino == stpwd.st_ino) {
+   struct stat stdot, stpwd;
+   char *pwd;
+   int i;
+
+   for (i = MAXPWD;; i *= 2) {
+   pwd = stalloc(i);
+   if (getcwd(pwd, i) != NULL)
return pwd;
-   }
-   return NULL;
+   stunalloc(pwd);
+   if (errno != ERANGE)
+   break;
+   }
+
+   pwd = getenv(PWD);
+   if (pwd  *pwd == '/'  stat(., stdot) != -1 
+   stat(pwd, stpwd) != -1 
+   stdot.st_dev == stpwd.st_dev 
+   stdot.st_ino == stpwd.st_ino) {
+   return pwd;
}
-   return buf;
+   return NULL;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208135 - stable/7/bin/sh

2010-05-16 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 16 10:20:54 2010
New Revision: 208135
URL: http://svn.freebsd.org/changeset/base/208135

Log:
  Merge r190698: Don't let trailing empty lines overwrite the result of the last
  command with 0.

Modified:
  stable/7/bin/sh/eval.c
Directory Properties:
  stable/7/bin/sh/   (props changed)

Modified: stable/7/bin/sh/eval.c
==
--- stable/7/bin/sh/eval.c  Sun May 16 10:01:06 2010(r208134)
+++ stable/7/bin/sh/eval.c  Sun May 16 10:20:54 2010(r208135)
@@ -166,7 +166,8 @@ evalstring(char *s)
setstackmark(smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
-   evaltree(n, 0);
+   if (n != NULL)
+   evaltree(n, 0);
popstackmark(smark);
}
popfile();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r208136 - stable/7/bin/sh

2010-05-16 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 16 10:23:33 2010
New Revision: 208136
URL: http://svn.freebsd.org/changeset/base/208136

Log:
  Merge r193169: Fix the eval command in combination with set -e.

Modified:
  stable/7/bin/sh/eval.c
  stable/7/bin/sh/eval.h
  stable/7/bin/sh/histedit.c
  stable/7/bin/sh/main.c
  stable/7/bin/sh/trap.c
Directory Properties:
  stable/7/bin/sh/   (props changed)

Modified: stable/7/bin/sh/eval.c
==
--- stable/7/bin/sh/eval.c  Sun May 16 10:20:54 2010(r208135)
+++ stable/7/bin/sh/eval.c  Sun May 16 10:23:33 2010(r208136)
@@ -83,6 +83,7 @@ MKINIT int evalskip;  /* set if we are s
 STATIC int skipcount;  /* number of levels to skip */
 MKINIT int loopnest;   /* current loop nesting level */
 int funcnest;  /* depth of function calls */
+STATIC int builtin_flags;  /* evalcommand flags for builtins */
 
 
 char *commandname;
@@ -147,7 +148,7 @@ evalcmd(int argc, char **argv)
 STPUTC('\0', concat);
 p = grabstackstr(concat);
 }
-evalstring(p);
+evalstring(p, builtin_flags  EV_TESTED);
 }
 return exitstatus;
 }
@@ -158,7 +159,7 @@ evalcmd(int argc, char **argv)
  */
 
 void
-evalstring(char *s)
+evalstring(char *s, int flags)
 {
union node *n;
struct stackmark smark;
@@ -167,7 +168,7 @@ evalstring(char *s)
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
if (n != NULL)
-   evaltree(n, 0);
+   evaltree(n, flags);
popstackmark(smark);
}
popfile();
@@ -841,6 +842,7 @@ evalcommand(union node *cmd, int flags, 
commandname = argv[0];
argptr = argv + 1;
optptr = NULL;  /* initialize nextopt */
+   builtin_flags = flags;
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
flushall();
 cmddone:

Modified: stable/7/bin/sh/eval.h
==
--- stable/7/bin/sh/eval.h  Sun May 16 10:20:54 2010(r208135)
+++ stable/7/bin/sh/eval.h  Sun May 16 10:23:33 2010(r208136)
@@ -46,7 +46,7 @@ struct backcmd {  /* result of evalbackc
 };
 
 int evalcmd(int, char **);
-void evalstring(char *);
+void evalstring(char *, int);
 union node;/* BLETCH for ansi C */
 void evaltree(union node *, int);
 void evalbackcmd(union node *, struct backcmd *);

Modified: stable/7/bin/sh/histedit.c
==
--- stable/7/bin/sh/histedit.c  Sun May 16 10:20:54 2010(r208135)
+++ stable/7/bin/sh/histedit.c  Sun May 16 10:23:33 2010(r208136)
@@ -350,7 +350,7 @@ histcmd(int argc, char **argv)
if (displayhist) {
out2str(s);
}
-   evalstring(s);
+   evalstring(s, 0);
if (displayhist  hist) {
/*
 *  XXX what about recursive and
@@ -382,7 +382,7 @@ histcmd(int argc, char **argv)
fclose(efp);
editcmd = stalloc(strlen(editor) + strlen(editfile) + 2);
sprintf(editcmd, %s %s, editor, editfile);
-   evalstring(editcmd);/* XXX - should use no JC command */
+   evalstring(editcmd, 0); /* XXX - should use no JC command */
INTON;
readcmdfile(editfile);  /* XXX - should read back - quick tst */
unlink(editfile);

Modified: stable/7/bin/sh/main.c
==
--- stable/7/bin/sh/main.c  Sun May 16 10:20:54 2010(r208135)
+++ stable/7/bin/sh/main.c  Sun May 16 10:23:33 2010(r208136)
@@ -178,7 +178,7 @@ state2:
 state3:
state = 4;
if (minusc) {
-   evalstring(minusc);
+   evalstring(minusc, 0);
}
if (sflag || minusc == NULL) {
 state4:/* XXX ??? - why isn't this before the if statement */

Modified: stable/7/bin/sh/trap.c
==
--- stable/7/bin/sh/trap.c  Sun May 16 10:20:54 2010(r208135)
+++ stable/7/bin/sh/trap.c  Sun May 16 10:23:33 2010(r208136)
@@ -416,7 +416,7 @@ dotrap(void)
if (i == SIGCHLD)
ignore_sigchld++;
savestatus = exitstatus;
-   evalstring(trap[i]);
+ 

Re: svn commit: r201794 - in head/sys: ddb dev/ep dev/ex netinet6

2010-01-08 Thread Stefan Farfeleder
On Fri, Jan 08, 2010 at 03:44:49PM +, Edward Tomasz Napierala wrote:
 Author: trasz
 Date: Fri Jan  8 15:44:49 2010
 New Revision: 201794
 URL: http://svn.freebsd.org/changeset/base/201794
 
 Log:
   Replace several instances of 'if (!a  b)' with 'if (!(a b))' in order
   to silence newer GCC versions.

They are not identical, !a  b is parsed as (!a)  b.  The code now
seems more correct however.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r200068 - head/usr.bin

2009-12-10 Thread Stefan Farfeleder
On Thu, Dec 03, 2009 at 06:02:55PM +, Roman Divacky wrote:
 Author: rdivacky
 Date: Thu Dec  3 18:02:55 2009
 New Revision: 200068
 URL: http://svn.freebsd.org/changeset/base/200068
 
 Log:
   Connect unzip to the build.
   
   Approved by:ed (mentor)
   Approved by:des (unzip author)
   Tested by:  exp ports build (miwi)

For me this breaks the ooo-3 build with:

unzip: -n, -o and -u are contradictory

The failing command is 'unzip -quo jurt_src.zip'.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r200120 - head/usr.bin/make

2009-12-05 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Dec  5 13:12:04 2009
New Revision: 200120
URL: http://svn.freebsd.org/changeset/base/200120

Log:
  Add a missing space to the error message when execvp() failed.

Modified:
  head/usr.bin/make/proc.c

Modified: head/usr.bin/make/proc.c
==
--- head/usr.bin/make/proc.cSat Dec  5 12:51:51 2009(r200119)
+++ head/usr.bin/make/proc.cSat Dec  5 13:12:04 2009(r200120)
@@ -116,7 +116,7 @@ Proc_Exec(const ProcStuff *ps)
execvp(ps-argv[0], ps-argv);
 
write(STDERR_FILENO, ps-argv[0], strlen(ps-argv[0]));
-   write(STDERR_FILENO, :, 1);
+   write(STDERR_FILENO, : , 2);
write(STDERR_FILENO, strerror(errno), strlen(strerror(errno)));
write(STDERR_FILENO, \n, 1);
} else {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199628 - head/tools/regression/bin/sh/builtins

2009-11-21 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Nov 21 14:12:51 2009
New Revision: 199628
URL: http://svn.freebsd.org/changeset/base/199628

Log:
  Add a few very basic tests for cd -{L,P} and pwd -{L,P}.

Modified:
  head/tools/regression/bin/sh/builtins/cd1.0

Modified: head/tools/regression/bin/sh/builtins/cd1.0
==
--- head/tools/regression/bin/sh/builtins/cd1.0 Sat Nov 21 12:38:45 2009
(r199627)
+++ head/tools/regression/bin/sh/builtins/cd1.0 Sat Nov 21 14:12:51 2009
(r199628)
@@ -1,17 +1,27 @@
 # $FreeBSD$
 set -e
 
-PDIR=${TMPDIR:-/tmp}
-cd ${PDIR}
-TMPDIR=$(mktemp -d sh-test.XX)
-chmod 0 ${TMPDIR}
+P=${TMPDIR:-/tmp}
+cd $P
+T=$(mktemp -d sh-test.XX)
 
-cd -L ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
-cd -P ${TMPDIR} 2/dev/null  exit 1
-[ ${PWD} = ${PDIR} ]
-[ $(pwd) = ${PDIR} ]
+chmod 0 $T
+cd -L $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
+cd -P $T 2/dev/null  exit 1
+[ $PWD = $P ]
+[ $(pwd) = $P ]
 
-chmod 755 ${TMPDIR}
-rmdir ${TMPDIR}
+chmod 755 $T
+cd $T
+mkdir -p 1/2/3
+ln -s 1/2 link1
+ln -s 2/3 1/link2
+(cd -L 1/../1  [ $(pwd -L) = $P/$T/1 ])
+(cd -L link1  [ $(pwd -L) = $P/$T/link1 ])
+(cd -L link1  [ $(pwd -P) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -L) = $P/$T/1/2 ])
+(cd -P link1  [ $(pwd -P) = $P/$T/1/2 ])
+
+rm -rf ${P}/${T}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199631 - head/bin/sh

2009-11-21 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Nov 21 14:53:22 2009
New Revision: 199631
URL: http://svn.freebsd.org/changeset/base/199631

Log:
  Handle current work directories of arbitrary length.  The argument to cd
  continues to be limited by PATH_MAX (1024).
  
  Obtained from:NetBSD
  PR:   104456

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==
--- head/bin/sh/cd.cSat Nov 21 14:53:08 2009(r199630)
+++ head/bin/sh/cd.cSat Nov 21 14:53:22 2009(r199631)
@@ -70,7 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
-STATIC char *getpwd2(char *, size_t);
+STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;/* current working directory */
 STATIC char *prevdir;  /* previous working directory */
@@ -263,10 +263,8 @@ findcwd(char *dir)
 * any more because we traversed a symbolic link or something
 * we couldn't stat().
 */
-   if (dir == NULL || curdir == NULL)  {
-   p = stalloc(PATH_MAX);
-   return getpwd2(p, PATH_MAX);
-   }
+   if (dir == NULL || curdir == NULL)
+   return getpwd2();
cdcomppath = stalloc(strlen(dir) + 1);
scopy(dir, cdcomppath);
STARTSTACKSTR(new);
@@ -313,7 +311,7 @@ updatepwd(char *dir)
 int
 pwdcmd(int argc, char **argv)
 {
-   char buf[PATH_MAX];
+   char *p;
int ch, phys;
 
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
@@ -341,9 +339,9 @@ pwdcmd(int argc, char **argv)
out1str(curdir);
out1c('\n');
} else {
-   if (getcwd(buf, sizeof(buf)) == NULL)
+   if ((p = getpwd2()) == NULL)
error(.: %s, strerror(errno));
-   out1str(buf);
+   out1str(p);
out1c('\n');
}
 
@@ -356,36 +354,45 @@ pwdcmd(int argc, char **argv)
 char *
 getpwd(void)
 {
-   char buf[PATH_MAX];
char *p;
 
if (curdir)
return curdir;
 
-   p = getpwd2(buf, sizeof(buf));
+   p = getpwd2();
if (p != NULL)
curdir = savestr(p);
 
return curdir;
 }
 
+#define MAXPWD 256
+
 /*
  * Return the current directory.
  */
 STATIC char *
-getpwd2(char *buf, size_t size)
+getpwd2(void)
 {
-   if (getcwd(buf, size) == NULL) {
-   char *pwd = getenv(PWD);
-   struct stat stdot, stpwd;
-
-   if (pwd  *pwd == '/'  stat(., stdot) != -1 
-   stat(pwd, stpwd) != -1 
-   stdot.st_dev == stpwd.st_dev 
-   stdot.st_ino == stpwd.st_ino) {
+   struct stat stdot, stpwd;
+   char *pwd;
+   int i;
+
+   for (i = MAXPWD;; i *= 2) {
+   pwd = stalloc(i);
+   if (getcwd(pwd, i) != NULL)
return pwd;
-   }
-   return NULL;
+   stunalloc(pwd);
+   if (errno != ERANGE)
+   break;
+   }
+
+   pwd = getenv(PWD);
+   if (pwd  *pwd == '/'  stat(., stdot) != -1 
+   stat(pwd, stpwd) != -1 
+   stdot.st_dev == stpwd.st_dev 
+   stdot.st_ino == stpwd.st_ino) {
+   return pwd;
}
-   return buf;
+   return NULL;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199632 - head/tools/regression/bin/sh/builtins

2009-11-21 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Nov 21 14:54:35 2009
New Revision: 199632
URL: http://svn.freebsd.org/changeset/base/199632

Log:
  Add a test for r199631.

Added:
  head/tools/regression/bin/sh/builtins/cd2.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/cd2.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/cd2.0 Sat Nov 21 14:54:35 2009
(r199632)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+set -e
+
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XX)
+cd $T
+D=$T
+for i in 0 1 2 3 4 5 6 7 8 9; do
+   for j in 0 1 2 3 4 5 6 7 8 9; do
+   mkdir veryverylongdirectoryname
+   cd veryverylongdirectoryname
+   D=$D/veryverylongdirectoryname
+   done
+done
+[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
+rm -rf ${T}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197862 - stable/7/bin/sh

2009-10-08 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct  8 17:11:01 2009
New Revision: 197862
URL: http://svn.freebsd.org/changeset/base/197862

Log:
  Merge r191009.
   Parse 'cmd1  ! cmd2 | cmd3' correctly, the bang should apply to the entire
   pipeline cmd2 | cmd3 and not just cmd2.

Modified:
  stable/7/bin/sh/   (props changed)
  stable/7/bin/sh/parser.c

Modified: stable/7/bin/sh/parser.c
==
--- stable/7/bin/sh/parser.cThu Oct  8 16:05:17 2009(r197861)
+++ stable/7/bin/sh/parser.cThu Oct  8 17:11:01 2009(r197862)
@@ -250,6 +250,7 @@ pipeline(void)
int negate;
 
negate = 0;
+   checkkwd = 2;
TRACE((pipeline: entered\n));
while (readtoken() == TNOT)
negate = !negate;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r193169 - head/bin/sh

2009-05-31 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 31 12:36:14 2009
New Revision: 193169
URL: http://svn.freebsd.org/changeset/base/193169

Log:
  Fix the eval command in combination with set -e.  Before this change the shell
  would always terminate if eval returned with a non-zero exit status regardless
  if the status was actually tested.  Unfortunately a new file-scope variable
  is needed, the alternative would only be to add a new parameter to all
  built-ins.
  
  PR:   134881

Modified:
  head/bin/sh/eval.c
  head/bin/sh/eval.h
  head/bin/sh/histedit.c
  head/bin/sh/main.c
  head/bin/sh/trap.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sun May 31 12:16:31 2009(r193168)
+++ head/bin/sh/eval.c  Sun May 31 12:36:14 2009(r193169)
@@ -83,6 +83,7 @@ MKINIT int evalskip;  /* set if we are s
 STATIC int skipcount;  /* number of levels to skip */
 MKINIT int loopnest;   /* current loop nesting level */
 int funcnest;  /* depth of function calls */
+STATIC int builtin_flags;  /* evalcommand flags for builtins */
 
 
 char *commandname;
@@ -147,7 +148,7 @@ evalcmd(int argc, char **argv)
 STPUTC('\0', concat);
 p = grabstackstr(concat);
 }
-evalstring(p);
+evalstring(p, builtin_flags  EV_TESTED);
 }
 return exitstatus;
 }
@@ -158,7 +159,7 @@ evalcmd(int argc, char **argv)
  */
 
 void
-evalstring(char *s)
+evalstring(char *s, int flags)
 {
union node *n;
struct stackmark smark;
@@ -167,7 +168,7 @@ evalstring(char *s)
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
if (n != NULL)
-   evaltree(n, 0);
+   evaltree(n, flags);
popstackmark(smark);
}
popfile();
@@ -839,6 +840,7 @@ evalcommand(union node *cmd, int flags, 
commandname = argv[0];
argptr = argv + 1;
optptr = NULL;  /* initialize nextopt */
+   builtin_flags = flags;
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
flushall();
 cmddone:

Modified: head/bin/sh/eval.h
==
--- head/bin/sh/eval.h  Sun May 31 12:16:31 2009(r193168)
+++ head/bin/sh/eval.h  Sun May 31 12:36:14 2009(r193169)
@@ -46,7 +46,7 @@ struct backcmd {  /* result of evalbackc
 };
 
 int evalcmd(int, char **);
-void evalstring(char *);
+void evalstring(char *, int);
 union node;/* BLETCH for ansi C */
 void evaltree(union node *, int);
 void evalbackcmd(union node *, struct backcmd *);

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Sun May 31 12:16:31 2009(r193168)
+++ head/bin/sh/histedit.c  Sun May 31 12:36:14 2009(r193169)
@@ -350,7 +350,7 @@ histcmd(int argc, char **argv)
if (displayhist) {
out2str(s);
}
-   evalstring(s);
+   evalstring(s, 0);
if (displayhist  hist) {
/*
 *  XXX what about recursive and
@@ -382,7 +382,7 @@ histcmd(int argc, char **argv)
fclose(efp);
editcmd = stalloc(strlen(editor) + strlen(editfile) + 2);
sprintf(editcmd, %s %s, editor, editfile);
-   evalstring(editcmd);/* XXX - should use no JC command */
+   evalstring(editcmd, 0); /* XXX - should use no JC command */
INTON;
readcmdfile(editfile);  /* XXX - should read back - quick tst */
unlink(editfile);

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Sun May 31 12:16:31 2009(r193168)
+++ head/bin/sh/main.c  Sun May 31 12:36:14 2009(r193169)
@@ -178,7 +178,7 @@ state2:
 state3:
state = 4;
if (minusc) {
-   evalstring(minusc);
+   evalstring(minusc, 0);
}
if (sflag || minusc == NULL) {
 state4:/* XXX ??? - why isn't this before the if statement */

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Sun May 31 12:16:31 2009(r193168)
+++ head/bin/sh/trap.c  Sun May 31 12:36:14 2009(r193169)
@@ -416,7 +416,7 @@ dotrap(void)
if (i == SIGCHLD)
ignore_sigchld++;
 

svn commit: r193178 - in head/tools/regression/bin/sh: builtins set-e

2009-05-31 Thread Stefan Farfeleder
Author: stefanf
Date: Sun May 31 17:23:27 2009
New Revision: 193178
URL: http://svn.freebsd.org/changeset/base/193178

Log:
  Add tests for r193169.

Added:
  head/tools/regression/bin/sh/builtins/eval1.0   (contents, props changed)
  head/tools/regression/bin/sh/set-e/eval1.0   (contents, props changed)
  head/tools/regression/bin/sh/set-e/eval2.1   (contents, props changed)
Modified:
  head/tools/regression/bin/sh/set-e/not2.0

Added: head/tools/regression/bin/sh/builtins/eval1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/eval1.0   Sun May 31 17:23:27 
2009(r193178)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+set -e
+
+eval
+eval  
+eval true
+! eval false
+
+

Added: head/tools/regression/bin/sh/set-e/eval1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/set-e/eval1.0  Sun May 31 17:23:27 2009
(r193178)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+set -e
+eval false || true

Added: head/tools/regression/bin/sh/set-e/eval2.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/set-e/eval2.1  Sun May 31 17:23:27 2009
(r193178)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+set -e
+eval false
+exit 0

Modified: head/tools/regression/bin/sh/set-e/not2.0
==
--- head/tools/regression/bin/sh/set-e/not2.0   Sun May 31 15:41:46 2009
(r193177)
+++ head/tools/regression/bin/sh/set-e/not2.0   Sun May 31 17:23:27 2009
(r193178)
@@ -1,3 +1,4 @@
 # $FreeBSD$
 set -e
 ! false
+! eval false
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191009 - head/bin/sh

2009-04-13 Thread Stefan Farfeleder
Author: stefanf
Date: Mon Apr 13 19:10:56 2009
New Revision: 191009
URL: http://svn.freebsd.org/changeset/base/191009

Log:
  Parse 'cmd1  ! cmd2 | cmd3' correctly, the bang should apply to the entire
  pipeline cmd2 | cmd3 and not just cmd2.
  
  PR:   130298
  Submitted by: Jilles Tjoelker

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cMon Apr 13 18:56:53 2009(r191008)
+++ head/bin/sh/parser.cMon Apr 13 19:10:56 2009(r191009)
@@ -250,6 +250,7 @@ pipeline(void)
int negate;
 
negate = 0;
+   checkkwd = 2;
TRACE((pipeline: entered\n));
while (readtoken() == TNOT)
negate = !negate;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191010 - head/tools/regression/bin/sh/parser

2009-04-13 Thread Stefan Farfeleder
Author: stefanf
Date: Mon Apr 13 19:12:28 2009
New Revision: 191010
URL: http://svn.freebsd.org/changeset/base/191010

Log:
  Add a test for r191009.

Added:
  head/tools/regression/bin/sh/parser/
  head/tools/regression/bin/sh/parser/and-pipe-not.0   (contents, props changed)

Added: head/tools/regression/bin/sh/parser/and-pipe-not.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/parser/and-pipe-not.0  Mon Apr 13 19:12:28 
2009(r191010)
@@ -0,0 +1,2 @@
+# $FreeBSD$
+true  ! true | false
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190698 - head/bin/sh

2009-04-04 Thread Stefan Farfeleder
Author: stefanf
Date: Sat Apr  4 19:06:52 2009
New Revision: 190698
URL: http://svn.freebsd.org/changeset/base/190698

Log:
  Don't let trailing empty lines overwrite the result of the last command with 
0.
  This affects the built-ins eval, fc, and trap and also the string passed to sh
  with the -c option.
  
  Submitted by: Jilles Tjoelker

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sat Apr  4 17:48:38 2009(r190697)
+++ head/bin/sh/eval.c  Sat Apr  4 19:06:52 2009(r190698)
@@ -166,7 +166,8 @@ evalstring(char *s)
setstackmark(smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
-   evaltree(n, 0);
+   if (n != NULL)
+   evaltree(n, 0);
popstackmark(smark);
}
popfile();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190270 - head/bin/sh

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 17:20:42 2009
New Revision: 190270
URL: http://svn.freebsd.org/changeset/base/190270

Log:
  Make the output of the alias built-in POSIX-compliant: Drop the leading 
'alias'
  and suppress printing the trailing space which is added for internal purposes.

Modified:
  head/bin/sh/alias.c

Modified: head/bin/sh/alias.c
==
--- head/bin/sh/alias.c Sun Mar 22 17:09:56 2009(r190269)
+++ head/bin/sh/alias.c Sun Mar 22 17:20:42 2009(r190270)
@@ -203,8 +203,13 @@ aliascmd(int argc, char **argv)
for (i = 0; i  ATABSIZE; i++)
for (ap = atab[i]; ap; ap = ap-next) {
if (*ap-name != '\0') {
-   out1fmt(alias %s=, ap-name);
+   out1fmt(%s=, ap-name);
+   /* Don't print the space added
+* above. */
+   v = ap-val + strlen(ap-val) - 1;
+   *v = '\0';
out1qstr(ap-val);
+   *v = ' ';
out1c('\n');
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190271 - head/tools/regression/bin/sh/builtins

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 17:22:14 2009
New Revision: 190271
URL: http://svn.freebsd.org/changeset/base/190271

Log:
  Update and extend the tests for alias.

Modified:
  head/tools/regression/bin/sh/builtins/alias.0
  head/tools/regression/bin/sh/builtins/alias.0.stdout

Modified: head/tools/regression/bin/sh/builtins/alias.0
==
--- head/tools/regression/bin/sh/builtins/alias.0   Sun Mar 22 17:20:42 
2009(r190270)
+++ head/tools/regression/bin/sh/builtins/alias.0   Sun Mar 22 17:22:14 
2009(r190271)
@@ -3,4 +3,6 @@ set -e
 
 unalias -a
 alias foo=bar
+alias bar=
+alias quux=1 2 3
 alias

Modified: head/tools/regression/bin/sh/builtins/alias.0.stdout
==
--- head/tools/regression/bin/sh/builtins/alias.0.stdoutSun Mar 22 
17:20:42 2009(r190270)
+++ head/tools/regression/bin/sh/builtins/alias.0.stdoutSun Mar 22 
17:22:14 2009(r190271)
@@ -1 +1,3 @@
-foo='bar'
+foo=bar
+bar=''
+quux='1 2 3'
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190284 - head/bin/sh

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 21:09:22 2009
New Revision: 190284
URL: http://svn.freebsd.org/changeset/base/190284

Log:
  - Apply the r190270 changes to printing of single aliases too.
  - Sort the aliases before printing them.

Modified:
  head/bin/sh/alias.c

Modified: head/bin/sh/alias.c
==
--- head/bin/sh/alias.c Sun Mar 22 21:00:58 2009(r190283)
+++ head/bin/sh/alias.c Sun Mar 22 21:09:22 2009(r190284)
@@ -50,6 +50,7 @@ __FBSDID($FreeBSD$);
 #define ATABSIZE 39
 
 STATIC struct alias *atab[ATABSIZE];
+STATIC int aliases;
 
 STATIC void setalias(char *, char *);
 STATIC int unalias(const char *);
@@ -106,6 +107,7 @@ setalias(char *name, char *val)
ap-flag = 0;
ap-next = *app;
*app = ap;
+   aliases++;
INTON;
 }
 
@@ -135,6 +137,7 @@ unalias(const char *name)
ckfree(ap);
INTON;
}
+   aliases--;
return (0);
}
}
@@ -168,6 +171,7 @@ rmaliases(void)
ckfree(tmp);
}
}
+   aliases = 0;
INTON;
 }
 
@@ -187,9 +191,47 @@ lookupalias(char *name, int check)
return (NULL);
 }
 
-/*
- * TODO - sort output
- */
+static int
+comparealiases(const void *p1, const void *p2)
+{
+   const struct alias *const *a1 = p1;
+   const struct alias *const *a2 = p2;
+
+   return strcmp((*a1)-name, (*a2)-name);
+}
+
+static void
+printalias(const struct alias *a)
+{
+   char *p;
+
+   out1fmt(%s=, a-name);
+   /* Don't print the space added above. */
+   p = a-val + strlen(a-val) - 1;
+   *p = '\0';
+   out1qstr(a-val);
+   *p = ' ';
+   out1c('\n');
+}
+
+static void
+printaliases(void)
+{
+   int i, j;
+   struct alias **sorted, *ap;
+
+   sorted = ckmalloc(aliases * sizeof(*sorted));
+   j = 0;
+   for (i = 0; i  ATABSIZE; i++)
+   for (ap = atab[i]; ap; ap = ap-next)
+   if (*ap-name != '\0')
+   sorted[j++] = ap;
+   qsort(sorted, aliases, sizeof(*sorted), comparealiases);
+   for (i = 0; i  aliases; i++)
+   printalias(sorted[i]);
+   ckfree(sorted);
+}
+
 int
 aliascmd(int argc, char **argv)
 {
@@ -198,21 +240,7 @@ aliascmd(int argc, char **argv)
struct alias *ap;
 
if (argc == 1) {
-   int i;
-
-   for (i = 0; i  ATABSIZE; i++)
-   for (ap = atab[i]; ap; ap = ap-next) {
-   if (*ap-name != '\0') {
-   out1fmt(%s=, ap-name);
-   /* Don't print the space added
-* above. */
-   v = ap-val + strlen(ap-val) - 1;
-   *v = '\0';
-   out1qstr(ap-val);
-   *v = ' ';
-   out1c('\n');
-   }
-   }
+   printaliases();
return (0);
}
while ((n = *++argv) != NULL) {
@@ -220,11 +248,8 @@ aliascmd(int argc, char **argv)
if ((ap = lookupalias(n, 0)) == NULL) {
outfmt(out2, alias: %s not found\n, n);
ret = 1;
-   } else {
-   out1fmt(alias %s=, n);
-   out1qstr(ap-val);
-   out1c('\n');
-   }
+   } else
+   printalias(ap);
else {
*v++ = '\0';
setalias(n, v);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190285 - head/tools/regression/bin/sh/builtins

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 21:12:00 2009
New Revision: 190285
URL: http://svn.freebsd.org/changeset/base/190285

Log:
  Update test for r190284.

Modified:
  head/tools/regression/bin/sh/builtins/alias.0
  head/tools/regression/bin/sh/builtins/alias.0.stdout

Modified: head/tools/regression/bin/sh/builtins/alias.0
==
--- head/tools/regression/bin/sh/builtins/alias.0   Sun Mar 22 21:09:22 
2009(r190284)
+++ head/tools/regression/bin/sh/builtins/alias.0   Sun Mar 22 21:12:00 
2009(r190285)
@@ -6,3 +6,4 @@ alias foo=bar
 alias bar=
 alias quux=1 2 3
 alias
+alias foo

Modified: head/tools/regression/bin/sh/builtins/alias.0.stdout
==
--- head/tools/regression/bin/sh/builtins/alias.0.stdoutSun Mar 22 
21:09:22 2009(r190284)
+++ head/tools/regression/bin/sh/builtins/alias.0.stdoutSun Mar 22 
21:12:00 2009(r190285)
@@ -1,3 +1,4 @@
-foo=bar
 bar=''
+foo=bar
 quux='1 2 3'
+foo=bar
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190295 - head/bin/sh

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 22:09:12 2009
New Revision: 190295
URL: http://svn.freebsd.org/changeset/base/190295

Log:
  Improve the IFS handling of the read built-in.
  
  Obtained from:NetBSD
  Submitted by: Jilles Tjoelker

Modified:
  head/bin/sh/miscbltin.c

Modified: head/bin/sh/miscbltin.c
==
--- head/bin/sh/miscbltin.c Sun Mar 22 22:08:30 2009(r190294)
+++ head/bin/sh/miscbltin.c Sun Mar 22 22:09:12 2009(r190295)
@@ -73,6 +73,16 @@ int ulimitcmd(int, char **);
  * ordinary characters.
  *
  * This uses unbuffered input, which may be avoidable in some cases.
+ *
+ * Note that if IFS=' :' then read x y should work so that:
+ * 'a b'   x='a', y='b'
+ * ' a b ' x='a', y='b'
+ * ':b'x='',  y='b'
+ * ':' x='',  y=''
+ * '::'x='',  y=''
+ * ': :'   x='',  y=''
+ * ':::'   x='',  y='::'
+ * ':b c:' x='',  y='b c:'
  */
 
 int
@@ -88,6 +98,8 @@ readcmd(int argc __unused, char **argv _
int startword;
int status;
int i;
+   int is_ifs;
+   int saveall = 0;
struct timeval tv;
char *tvptr;
fd_set ifds;
@@ -167,7 +179,7 @@ readcmd(int argc __unused, char **argv _
}
 
status = 0;
-   startword = 1;
+   startword = 2;
backslash = 0;
STARTSTACKSTR(p);
for (;;) {
@@ -189,22 +201,68 @@ readcmd(int argc __unused, char **argv _
}
if (c == '\n')
break;
-   if (startword  *ifs == ' '  strchr(ifs, c)) {
+   if (strchr(ifs, c))
+   is_ifs = strchr( \t\n, c) ? 1 : 2;
+   else
+   is_ifs = 0;
+
+   if (startword != 0) {
+   if (is_ifs == 1) {
+   /* Ignore leading IFS whitespace */
+   if (saveall)
+   STPUTC(c, p);
+   continue;
+   }
+   if (is_ifs == 2  startword == 1) {
+   /* Only one non-whitespace IFS per word */
+   startword = 2;
+   if (saveall)
+   STPUTC(c, p);
+   continue;
+   }
+   }
+
+   if (is_ifs == 0) {
+   /* append this character to the current variable */
+   startword = 0;
+   if (saveall)
+   /* Not just a spare terminator */
+   saveall++;
+   STPUTC(c, p);
continue;
}
-   startword = 0;
-   if (ap[1] != NULL  strchr(ifs, c) != NULL) {
-   STACKSTRNUL(p);
-   setvar(*ap, stackblock(), 0);
-   ap++;
-   startword = 1;
-   STARTSTACKSTR(p);
-   } else {
+
+   /* end of variable... */
+   startword = is_ifs;
+
+   if (ap[1] == NULL) {
+   /* Last variable needs all IFS chars */
+   saveall++;
STPUTC(c, p);
+   continue;
}
+
+   STACKSTRNUL(p);
+   setvar(*ap, stackblock(), 0);
+   ap++;
+   STARTSTACKSTR(p);
}
STACKSTRNUL(p);
+
+   /* Remove trailing IFS chars */
+   for (; stackblock() = --p; *p = 0) {
+   if (!strchr(ifs, *p))
+   break;
+   if (strchr( \t\n, *p))
+   /* Always remove whitespace */
+   continue;
+   if (saveall  1)
+   /* Don't remove non-whitespace unless it was naked */
+   break;
+   }
setvar(*ap, stackblock(), 0);
+
+   /* Set any remaining args to  */
while (*++ap != NULL)
setvar(*ap, nullstr, 0);
return status;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190300 - head/tools/regression/bin/sh/builtins

2009-03-22 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Mar 22 23:00:52 2009
New Revision: 190300
URL: http://svn.freebsd.org/changeset/base/190300

Log:
  Test the r190298 change.

Modified:
  head/tools/regression/bin/sh/builtins/read1.0
  head/tools/regression/bin/sh/builtins/read1.0.stdout

Modified: head/tools/regression/bin/sh/builtins/read1.0
==
--- head/tools/regression/bin/sh/builtins/read1.0   Sun Mar 22 23:00:00 
2009(r190299)
+++ head/tools/regression/bin/sh/builtins/read1.0   Sun Mar 22 23:00:52 
2009(r190300)
@@ -7,6 +7,7 @@ echo 1 2 3| { read a b c; echo x${a
 echo 1 2 3   | { read a b c d; echo x${a}x${b}x${c}x${d}x; }
 
 echo  1  2 3 | { read a b c; echo x${a}x${b}x${c}x; }
+echo  1  2 3 | { unset IFS; read a b c; echo x${a}x${b}x${c}x; }
 echo  1  2 3 | { IFS=$(printf ' \t\n') read a b c; echo 
x${a}x${b}x${c}x; }
 echo  1  2 3 | { IFS= read a b; echo x${a}x${b}x; }
 

Modified: head/tools/regression/bin/sh/builtins/read1.0.stdout
==
--- head/tools/regression/bin/sh/builtins/read1.0.stdoutSun Mar 22 
23:00:00 2009(r190299)
+++ head/tools/regression/bin/sh/builtins/read1.0.stdoutSun Mar 22 
23:00:52 2009(r190300)
@@ -4,6 +4,7 @@ x1x2x3x
 x1x2x3xx
 x1x2x3x
 x1x2x3x
+x1x2x3x
 x  1  2 3 xx
 x1x2x3x
 xx2x3x
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r185401 - head/bin/sh

2008-11-28 Thread Stefan Farfeleder
Author: stefanf
Date: Fri Nov 28 18:55:42 2008
New Revision: 185401
URL: http://svn.freebsd.org/changeset/base/185401

Log:
  Report error messages of the builtins 'type' and 'command -V' to stderr 
instead
  of stdout.
  
  Noticed by:   Zajcev Evgeny

Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==
--- head/bin/sh/exec.c  Fri Nov 28 18:35:14 2008(r185400)
+++ head/bin/sh/exec.c  Fri Nov 28 18:55:42 2008(r185401)
@@ -728,9 +728,6 @@ typecmd_impl(int argc, char **argv, int 
extern char *const parsekwd[];
 
for (i = 1; i  argc; i++) {
-   if (cmd != TYPECMD_SMALLV)
-   out1str(argv[i]);
-
/* First look at the keywords */
for (pp = (char **)parsekwd; *pp; pp++)
if (**pp == *argv[i]  equal(*pp, argv[i]))
@@ -740,7 +737,7 @@ typecmd_impl(int argc, char **argv, int 
if (cmd == TYPECMD_SMALLV)
out1fmt(%s\n, argv[i]);
else
-   out1str( is a shell keyword\n);
+   out1fmt(%s is a shell keyword\n, argv[i]);
continue;
}
 
@@ -749,7 +746,8 @@ typecmd_impl(int argc, char **argv, int 
if (cmd == TYPECMD_SMALLV)
out1fmt(alias %s='%s'\n, argv[i], ap-val);
else
-   out1fmt( is an alias for %s\n, ap-val);
+   out1fmt(%s is an alias for %s\n, argv[i],
+   ap-val);
continue;
}
 
@@ -775,7 +773,7 @@ typecmd_impl(int argc, char **argv, int 
if (cmd == TYPECMD_SMALLV)
out1fmt(%s\n, name);
else
-   out1fmt( is%s %s\n,
+   out1fmt(%s is%s %s\n, argv[i],
(cmdp  cmd == TYPECMD_TYPE) ?
 a tracked alias for : ,
name);
@@ -784,11 +782,12 @@ typecmd_impl(int argc, char **argv, int 
if (cmd == TYPECMD_SMALLV)
out1fmt(%s\n, argv[i]);
else
-   out1fmt( is %s\n, argv[i]);
+   out1fmt(%s is %s\n, argv[i],
+   argv[i]);
} else {
if (cmd != TYPECMD_SMALLV)
-   out1fmt(: %s\n,
-   strerror(errno));
+   outfmt(out2, %s: %s\n,
+   argv[i], strerror(errno));
error |= 127;
}
}
@@ -798,19 +797,19 @@ typecmd_impl(int argc, char **argv, int 
if (cmd == TYPECMD_SMALLV)
out1fmt(%s\n, argv[i]);
else
-   out1str( is a shell function\n);
+   out1fmt(%s is a shell function\n, argv[i]);
break;
 
case CMDBUILTIN:
if (cmd == TYPECMD_SMALLV)
out1fmt(%s\n, argv[i]);
else
-   out1str( is a shell builtin\n);
+   out1fmt(%s is a shell builtin\n, argv[i]);
break;
 
default:
if (cmd != TYPECMD_SMALLV)
-   out1str(: not found\n);
+   outfmt(out2, %s: not found\n, argv[i]);
error |= 127;
break;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to [EMAIL PROTECTED]


svn commit: r185402 - head/tools/regression/bin/sh/builtins

2008-11-28 Thread Stefan Farfeleder
Author: stefanf
Date: Fri Nov 28 18:59:04 2008
New Revision: 185402
URL: http://svn.freebsd.org/changeset/base/185402

Log:
  Update for 185401, errors now go to stderr.

Added:
  head/tools/regression/bin/sh/builtins/type1.0.stderr   (props changed)
 - copied unchanged from r181018, 
head/tools/regression/bin/sh/builtins/type1.0.stdout
Deleted:
  head/tools/regression/bin/sh/builtins/type1.0.stdout

Copied: head/tools/regression/bin/sh/builtins/type1.0.stderr (from r181018, 
head/tools/regression/bin/sh/builtins/type1.0.stdout)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/type1.0.stderrFri Nov 28 
18:59:04 2008(r185402, copy of r181018, 
head/tools/regression/bin/sh/builtins/type1.0.stdout)
@@ -0,0 +1,4 @@
+not-here: not found
+/not-here: No such file or directory
+not-here: not found
+/not-here: No such file or directory
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to [EMAIL PROTECTED]


svn commit: r185231 - head/bin/sh

2008-11-23 Thread Stefan Farfeleder
Author: stefanf
Date: Sun Nov 23 20:23:57 2008
New Revision: 185231
URL: http://svn.freebsd.org/changeset/base/185231

Log:
  Fix $? at the first command of a function.  The previous exit status was saved
  twice and thus lost.

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sun Nov 23 20:19:35 2008(r185230)
+++ head/bin/sh/eval.c  Sun Nov 23 20:23:57 2008(r185231)
@@ -791,6 +791,7 @@ evalcommand(union node *cmd, int flags, 
for (sp = varlist.list ; sp ; sp = sp-next)
mklocal(sp-text);
funcnest++;
+   exitstatus = oexitstatus;
if (flags  EV_TESTED)
evaltree(cmdentry.u.func, EV_TESTED);
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to [EMAIL PROTECTED]