svn commit: r319642 - in head: bin/chmod bin/chmod/tests etc/mtree

2017-06-06 Thread Ngie Cooper
Author: ngie
Date: Wed Jun  7 05:33:56 2017
New Revision: 319642
URL: https://svnweb.freebsd.org/changeset/base/319642

Log:
  Add some basic tests for chmod(1)
  
  MFC after:1 month
  Sponsored by: Dell EMC Isilon

Added:
  head/bin/chmod/tests/
  head/bin/chmod/tests/Makefile   (contents, props changed)
  head/bin/chmod/tests/chmod_test.sh   (contents, props changed)
Modified:
  head/bin/chmod/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/chmod/Makefile
==
--- head/bin/chmod/Makefile Wed Jun  7 01:48:11 2017(r319641)
+++ head/bin/chmod/Makefile Wed Jun  7 05:33:56 2017(r319642)
@@ -1,7 +1,11 @@
 #  @(#)Makefile8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
+.include 
+
 PACKAGE=runtime
 PROG=  chmod
+
+SUBDIR.${MK_TESTS}+=   tests
 
 .include 

Added: head/bin/chmod/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/chmod/tests/Makefile   Wed Jun  7 05:33:56 2017
(r319642)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH+= chmod_test
+
+.include 

Added: head/bin/chmod/tests/chmod_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/chmod/tests/chmod_test.sh  Wed Jun  7 05:33:56 2017
(r319642)
@@ -0,0 +1,160 @@
+#
+# Copyright (c) 2017 Dell EMC
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case RH_flag
+RH_flag_head()
+{
+   atf_set "descr" "Verify that setting modes recursively via -R doesn't " 
\
+   "affect symlinks specified via the arguments when -H " \
+   "is specified"
+}
+RH_flag_body()
+{
+   atf_check mkdir -m 0777 -p A/B
+   atf_check ln -s B A/C
+   atf_check chmod -h 0777 A/C
+   atf_check -o inline:'40755\n40777\n120777\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RH 0700 A
+   atf_check -o inline:'40700\n40700\n120700\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RH 0600 A/C
+   atf_check -o inline:'40700\n40600\n120700\n' stat -f '%p' A A/B A/C
+}
+
+atf_test_case RL_flag
+RL_flag_head()
+{
+   atf_set "descr" "Verify that setting modes recursively via -R doesn't " 
\
+   "affect symlinks specified via the arguments when -L " \
+   "is specified"
+}
+RL_flag_body()
+{
+   atf_check mkdir -m 0777 -p A/B
+   atf_check ln -s B A/C
+   atf_check chmod -h 0777 A/C
+   atf_check -o inline:'40755\n40777\n120777\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RL 0700 A
+   atf_check -o inline:'40700\n40700\n120777\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RL 0600 A/C
+   atf_check -o inline:'40700\n40600\n120777\n' stat -f '%p' A A/B A/C
+}
+
+atf_test_case RP_flag
+RP_flag_head()
+{
+   atf_set "descr" "Verify that setting modes recursively via -R doesn't " 
\
+   "affect symlinks specified via the arguments when -P " \
+   "is specified"
+}
+RP_flag_body()
+{
+   atf_check mkdir -m 0777 -p A/B
+   atf_check ln -s B A/C
+   atf_check chmod -h 0777 A/C
+   atf_check -o inline:'40755\n40777\n120777\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RP 0700 A
+   atf_check -o inline:'40700\n40700\n120700\n' stat -f '%p' A A/B A/C
+   atf_check chmod -RP 0600 A/C
+   atf_check -o inline:'40700\n40700\n120600\n' stat -f '%p' A A/B A/C
+}
+
+atf_test_case f_flag cleanup
+f_flag_head()
+{
+   atf_set "descr" "Verify that setting a 

svn commit: r319641 - in head/sys: kern sys

2017-06-06 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jun  7 01:48:11 2017
New Revision: 319641
URL: https://svnweb.freebsd.org/changeset/base/319641

Log:
  Provide typedef for socket upcall function.
  While here change so_gen_t type to modern uint64_t.

Modified:
  head/sys/kern/uipc_socket.c
  head/sys/sys/socketvar.h

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Wed Jun  7 01:21:34 2017(r319640)
+++ head/sys/kern/uipc_socket.c Wed Jun  7 01:48:11 2017(r319641)
@@ -3559,8 +3559,7 @@ sodupsockaddr(const struct sockaddr *sa, int mflags)
  * Register per-socket buffer upcalls.
  */
 void
-soupcall_set(struct socket *so, int which,
-int (*func)(struct socket *, void *, int), void *arg)
+soupcall_set(struct socket *so, int which, so_upcall_t func, void *arg)
 {
struct sockbuf *sb;
 

Modified: head/sys/sys/socketvar.h
==
--- head/sys/sys/socketvar.hWed Jun  7 01:21:34 2017(r319640)
+++ head/sys/sys/socketvar.hWed Jun  7 01:48:11 2017(r319641)
@@ -55,7 +55,8 @@ struct vnet;
  * handle on protocol and pointer to protocol
  * private data and error information.
  */
-typedefu_quad_t so_gen_t;
+typedefuint64_t so_gen_t;
+typedefint so_upcall_t(struct socket *, void *, int);
 
 struct socket;
 
@@ -400,9 +401,8 @@ int sosend_generic(struct socket *so, struct sockaddr 
int flags, struct thread *td);
 intsoshutdown(struct socket *so, int how);
 void   sotoxsocket(struct socket *so, struct xsocket *xso);
-void   soupcall_clear(struct socket *so, int which);
-void   soupcall_set(struct socket *so, int which,
-   int (*func)(struct socket *, void *, int), void *arg);
+void   soupcall_clear(struct socket *, int);
+void   soupcall_set(struct socket *, int, so_upcall_t, void *);
 void   sowakeup(struct socket *so, struct sockbuf *sb);
 void   sowakeup_aio(struct socket *so, struct sockbuf *sb);
 intselsocket(struct socket *so, int events, struct timeval *tv,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319640 - head/sys/kern

2017-06-06 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jun  7 01:21:34 2017
New Revision: 319640
URL: https://svnweb.freebsd.org/changeset/base/319640

Log:
  Remove a piece of dead code.

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Tue Jun  6 22:17:55 2017(r319639)
+++ head/sys/kern/uipc_socket.c Wed Jun  7 01:21:34 2017(r319640)
@@ -3575,10 +3575,6 @@ soupcall_set(struct socket *so, int which,
panic("soupcall_set: bad which");
}
SOCKBUF_LOCK_ASSERT(sb);
-#if 0
-   /* XXX: accf_http actually wants to do this on purpose. */
-   KASSERT(sb->sb_upcall == NULL, ("soupcall_set: overwriting upcall"));
-#endif
sb->sb_upcall = func;
sb->sb_upcallarg = arg;
sb->sb_flags |= SB_UPCALL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-06-06 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Jun  6 22:17:55 2017
New Revision: 319639
URL: https://svnweb.freebsd.org/changeset/base/319639

Log:
  When the input parameter node is NULL, memory is allocated to it.
  To later free the memory, introduce a new variable lnode to track when
  this happens.
  
  Submitted by: Thomas Rix 
  Reviewed by:  emax
  Approved by:  sjg (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D9878

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

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.c
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.c   Tue Jun  6 21:51:04 
2017(r319638)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.c   Tue Jun  6 22:17:55 
2017(r319639)
@@ -103,13 +103,14 @@ socket_open(char const *node)
int  s, mib[4], num;
size_t   size;
struct nodeinfo *nodes;
+   char*lnode = NULL;
 
num = find_hci_nodes();
if (num == 0)
errx(7, "Could not find HCI nodes");
 
if (node == NULL) {
-   node = strdup(nodes[0].name);
+   node = lnode = strdup(nodes[0].name);
if (num > 1)
fprintf(stdout, "Using HCI node: %s\n", node);
}
@@ -130,6 +131,7 @@ socket_open(char const *node)
if (connect(s, (struct sockaddr *) , sizeof(addr)) < 0)
err(3, "Could not connect socket, node=%s", node);
 
+   free(lnode);
memset(, 0, sizeof(filter));
bit_set(filter.event_mask, NG_HCI_EVENT_COMMAND_COMPL - 1);
bit_set(filter.event_mask, NG_HCI_EVENT_COMMAND_STATUS - 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319638 - head/usr.sbin/ppp

2017-06-06 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Jun  6 21:51:04 2017
New Revision: 319638
URL: https://svnweb.freebsd.org/changeset/base/319638

Log:
  Before returning because of an memory allocation error, free the memory
  already allocated to buf.
  
  Found using clang's static analyzer - scan-build
  
  Submitted by: Thomas Rix 
  Reviewed by:  stevek
  Approved by:  sjg (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D9852

Modified:
  head/usr.sbin/ppp/iface.c

Modified: head/usr.sbin/ppp/iface.c
==
--- head/usr.sbin/ppp/iface.c   Tue Jun  6 21:50:00 2017(r319637)
+++ head/usr.sbin/ppp/iface.c   Tue Jun  6 21:51:04 2017(r319638)
@@ -145,6 +145,7 @@ iface_Create(const char *name)
   iface = (struct iface *)malloc(sizeof *iface);
   if (iface == NULL) {
 fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno));
+   free(buf);
 return NULL;
   }
   iface->name = strdup(name);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319637 - in head: bin/cat/tests contrib/netbsd-tests/bin/cat

2017-06-06 Thread Ngie Cooper
Author: ngie
Date: Tue Jun  6 21:50:00 2017
New Revision: 319637
URL: https://svnweb.freebsd.org/changeset/base/319637

Log:
  Add testcases for `cat -b`
  
  MFC after:1 month
  Sponsored by: Dell EMC Isilon

Added:
  head/contrib/netbsd-tests/bin/cat/d_b_output.in   (contents, props changed)
  head/contrib/netbsd-tests/bin/cat/d_b_output.out
Modified:
  head/bin/cat/tests/Makefile
  head/contrib/netbsd-tests/bin/cat/t_cat.sh

Modified: head/bin/cat/tests/Makefile
==
--- head/bin/cat/tests/Makefile Tue Jun  6 21:40:35 2017(r319636)
+++ head/bin/cat/tests/Makefile Tue Jun  6 21:50:00 2017(r319637)
@@ -6,6 +6,8 @@ NETBSD_ATF_TESTS_SH=cat_test
 
 ${PACKAGE}FILES+=  d_align.in
 ${PACKAGE}FILES+=  d_align.out
+${PACKAGE}FILES+=  d_b_output.in
+${PACKAGE}FILES+=  d_b_output.out
 ${PACKAGE}FILES+=  d_se_output.in
 ${PACKAGE}FILES+=  d_se_output.out
 ${PACKAGE}FILES+=  d_s_output.in

Added: head/contrib/netbsd-tests/bin/cat/d_b_output.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_b_output.in Tue Jun  6 21:50:00 
2017(r319637)
@@ -0,0 +1,4 @@
+This is a line
+
+The line before this was a blank line.
+This line has leading whitespace.

Added: head/contrib/netbsd-tests/bin/cat/d_b_output.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_b_output.outTue Jun  6 21:50:00 
2017(r319637)
@@ -0,0 +1,4 @@
+ 1 This is a line
+
+ 2 The line before this was a blank line.
+ 3 This line has leading whitespace.

Modified: head/contrib/netbsd-tests/bin/cat/t_cat.sh
==
--- head/contrib/netbsd-tests/bin/cat/t_cat.sh  Tue Jun  6 21:40:35 2017
(r319636)
+++ head/contrib/netbsd-tests/bin/cat/t_cat.sh  Tue Jun  6 21:50:00 2017
(r319637)
@@ -52,6 +52,19 @@ nonexistent_body() {
-x "cat /some/name/that/does/not/exist"
 }
 
+# Begin FreeBSD
+atf_test_case b_output
+b_output_head() {
+   atf_set "descr" "Test that cat(1) prints out numbers on non-blank "\
+   "lines with '-b'"
+}
+
+b_output_body() {
+   atf_check -o file:$(atf_get_srcdir)/d_b_output.out \
+   cat -b $(atf_get_srcdir)/d_b_output.in
+}
+# End FreeBSD
+
 atf_test_case se_output
 se_output_head() {
atf_set "descr" "Test that cat(1) prints a $ sign " \
@@ -103,6 +116,9 @@ atf_init_test_cases()
 {
atf_add_test_case align
atf_add_test_case nonexistent
+# Begin FreeBSD
+   atf_add_test_case b_output
+# End FreeBSD
atf_add_test_case se_output
 # Begin FreeBSD
atf_add_test_case s_output
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319636 - head/usr.bin/tset

2017-06-06 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Jun  6 21:40:35 2017
New Revision: 319636
URL: https://svnweb.freebsd.org/changeset/base/319636

Log:
  The memory assigned to the local variable 'copy' needs to be freed.
  
  Found using clang's static analyzer - scan-build
  
  Submitted by: Thomas Rix 
  Reviewed by:  ed
  Approved by:  sjg (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D9663

Modified:
  head/usr.bin/tset/map.c

Modified: head/usr.bin/tset/map.c
==
--- head/usr.bin/tset/map.c Tue Jun  6 21:08:05 2017(r319635)
+++ head/usr.bin/tset/map.c Tue Jun  6 21:40:35 2017(r319636)
@@ -157,6 +157,7 @@ done:   if (port) {
 badmopt:   errx(1, "illegal -m option format: %s", copy);
mapp->porttype = strdup(port);
}
+   free(copy);
 
 #ifdef MAPDEBUG
(void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319635 - head/bin/sh

2017-06-06 Thread Jilles Tjoelker
Author: jilles
Date: Tue Jun  6 21:08:05 2017
New Revision: 319635
URL: https://svnweb.freebsd.org/changeset/base/319635

Log:
  sh: Call fc -e editor with interrupts enabled.
  
  Starting the fc -e editor can execute arbitrary script, and executing
  arbitrary script with INTOFF in effect may cause unexpected results.
  
  This change (together with other changes) serves mainly to allow asserting
  that INTOFF is not in effect when starting the evaluation of a node.

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Tue Jun  6 21:03:43 2017(r319634)
+++ head/bin/sh/histedit.c  Tue Jun  6 21:08:05 2017(r319635)
@@ -376,10 +376,10 @@ histcmd(int argc, char **argv __unused)
char *editcmd;
 
fclose(efp);
+   INTON;
editcmd = stalloc(strlen(editor) + strlen(editfile) + 2);
sprintf(editcmd, "%s %s", editor, editfile);
evalstring(editcmd, 0); /* XXX - should use no JC command */
-   INTON;
readcmdfile(editfile);  /* XXX - should read back - quick tst */
unlink(editfile);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319634 - in head: bin/cat/tests contrib/netbsd-tests/bin/cat

2017-06-06 Thread Ngie Cooper
Author: ngie
Date: Tue Jun  6 21:03:43 2017
New Revision: 319634
URL: https://svnweb.freebsd.org/changeset/base/319634

Log:
  Add additional testcases for cat(1)
  
  Verify the following additional cases:
  - -s (in isolation, in addition to the -se testcase obtained via the
NetBSD test).
  - -vt
  
  Submitted by: shivansh
  Reviewed by:  asomers (earlier diff), ngie
  MFC after:1 month
  Sponsored by: Google, Inc (GSoC 2017)
  Differential Revision:D11020

Added:
  head/contrib/netbsd-tests/bin/cat/d_s_output.in   (contents, props changed)
  head/contrib/netbsd-tests/bin/cat/d_s_output.out
  head/contrib/netbsd-tests/bin/cat/d_vt_output.in   (contents, props changed)
  head/contrib/netbsd-tests/bin/cat/d_vt_output.out
Modified:
  head/bin/cat/tests/Makefile
  head/contrib/netbsd-tests/bin/cat/t_cat.sh

Modified: head/bin/cat/tests/Makefile
==
--- head/bin/cat/tests/Makefile Tue Jun  6 19:21:35 2017(r319633)
+++ head/bin/cat/tests/Makefile Tue Jun  6 21:03:43 2017(r319634)
@@ -8,6 +8,10 @@ ${PACKAGE}FILES+=  d_align.in
 ${PACKAGE}FILES+=  d_align.out
 ${PACKAGE}FILES+=  d_se_output.in
 ${PACKAGE}FILES+=  d_se_output.out
+${PACKAGE}FILES+=  d_s_output.in
+${PACKAGE}FILES+=  d_s_output.out
+${PACKAGE}FILES+=  d_vt_output.in
+${PACKAGE}FILES+=  d_vt_output.out
 
 .include 
 

Added: head/contrib/netbsd-tests/bin/cat/d_s_output.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_s_output.in Tue Jun  6 21:03:43 
2017(r319634)
@@ -0,0 +1,6 @@
+a b c
+
+
+1 2 3
+
+x y z

Added: head/contrib/netbsd-tests/bin/cat/d_s_output.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_s_output.outTue Jun  6 21:03:43 
2017(r319634)
@@ -0,0 +1,5 @@
+a b c
+
+1 2 3
+
+x y z

Added: head/contrib/netbsd-tests/bin/cat/d_vt_output.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_vt_output.inTue Jun  6 21:03:43 
2017(r319634)
@@ -0,0 +1,3 @@
+   
+
+�

Added: head/contrib/netbsd-tests/bin/cat/d_vt_output.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/bin/cat/d_vt_output.out   Tue Jun  6 21:03:43 
2017(r319634)
@@ -0,0 +1,3 @@
+^I
+^X
+M-a

Modified: head/contrib/netbsd-tests/bin/cat/t_cat.sh
==
--- head/contrib/netbsd-tests/bin/cat/t_cat.sh  Tue Jun  6 19:21:35 2017
(r319633)
+++ head/contrib/netbsd-tests/bin/cat/t_cat.sh  Tue Jun  6 21:03:43 2017
(r319634)
@@ -63,9 +63,50 @@ se_output_body() {
-x "cat -se $(atf_get_srcdir)/d_se_output.in"
 }
 
+# Begin FreeBSD
+atf_test_case s_output
+s_output_head() {
+   atf_set "descr" "Test that cat(1) squeezes multiple adjacent " \
+   "empty lines producing a single spaced output with 
option '-s'"
+}
+
+s_output_body() {
+   atf_check -s ignore -o file:$(atf_get_srcdir)/d_s_output.out \
+   cat -s $(atf_get_srcdir)/d_s_output.in
+}
+
+atf_test_case e_output
+e_output_head() {
+   atf_set "descr" "Test that cat(1) prints a $ sign " \
+   "on blank lines with option '-e'"
+}
+
+e_output_body() {
+   atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \
+   cat -e $(atf_get_srcdir)/d_se_output.in
+}
+
+atf_test_case vt_output
+vt_output_head() {
+   atf_set "descr" "Test that cat(1) displays non-printing characters, " \
+   "namely control characters, tab character and 
meta-characters " \
+   "using options '-vt'"
+}
+
+vt_output_body() {
+   atf_check -s ignore -o file:$(atf_get_srcdir)/d_vt_output.out \
+   cat -vt $(atf_get_srcdir)/d_vt_output.in
+}
+# End FreeBSD
+
 atf_init_test_cases()
 {
atf_add_test_case align
atf_add_test_case nonexistent
atf_add_test_case se_output
+# Begin FreeBSD
+   atf_add_test_case s_output
+   atf_add_test_case e_output
+   atf_add_test_case vt_output
+# End FreeBSD
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r319627 - head/sys/vm

2017-06-06 Thread Alan Cox
Author: alc
Date: Tue Jun  6 16:52:07 2017
New Revision: 319627
URL: https://svnweb.freebsd.org/changeset/base/319627

Log:
  Starting in r118390, swaponsomething() began to reserve the blocks at the
  beginning of a swap area for a disk label.  However, neither r118390 nor
  r118544, which increased the reservation from one to two blocks, correctly
  accounted for these blocks when updating the variable "swap_pager_avail".
  This change corrects that error.
  
  Reviewed by:  kib
  MFC after:5 days

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cTue Jun  6 16:04:27 2017(r319626)
+++ head/sys/vm/swap_pager.cTue Jun  6 16:52:07 2017(r319627)
@@ -2203,7 +2203,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl
sp->sw_end = dvbase + nblks;
TAILQ_INSERT_TAIL(, sp, sw_list);
nswapdev++;
-   swap_pager_avail += nblks;
+   swap_pager_avail += nblks - 2;
swap_total += (vm_ooffset_t)nblks * PAGE_SIZE;
swapon_check_swzone(swap_total / PAGE_SIZE);
swp_sizecheck();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319626 - in head: bin/echo bin/echo/tests etc/mtree

2017-06-06 Thread Ngie Cooper
Author: ngie
Date: Tue Jun  6 16:04:27 2017
New Revision: 319626
URL: https://svnweb.freebsd.org/changeset/base/319626

Log:
  Add basic tests for echo(1)
  
  Verify that echo(1) does not...
  - ... print the trailing newline character with option '-n'.
  - ... print the trailing newline character when '\c' is appended to
the end of the string.
  
  Submitted by: shivansh
  Reviewed by:  asomers, ngie
  MFC after:1 month
  Sponsored by: Google, Inc (GSoC 2017)
  Differential Revision:D11036

Added:
  head/bin/echo/tests/
  head/bin/echo/tests/Makefile   (contents, props changed)
  head/bin/echo/tests/echo_test.sh   (contents, props changed)
Modified:
  head/bin/echo/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/echo/Makefile
==
--- head/bin/echo/Makefile  Tue Jun  6 14:46:45 2017(r319625)
+++ head/bin/echo/Makefile  Tue Jun  6 16:04:27 2017(r319626)
@@ -1,7 +1,13 @@
 #  @(#)Makefile8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
+.include 
+
 PACKAGE=runtime
 PROG=  echo
+
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
 
 .include 

Added: head/bin/echo/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/echo/tests/MakefileTue Jun  6 16:04:27 2017
(r319626)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH+=  echo_test
+
+.include 

Added: head/bin/echo/tests/echo_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/echo/tests/echo_test.shTue Jun  6 16:04:27 2017
(r319626)
@@ -0,0 +1,55 @@
+#
+# Copyright 2017 Shivansh Rai
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+atf_test_case n_output
+n_output_head() {
+atf_set "descr" "Verify that echo(1) does not print the trailing " \
+"newline character with option '-n'"
+}
+
+n_output_body() {
+atf_check -s ignore -o inline:"Hello world" \
+/bin/echo -n "Hello world"
+}
+
+atf_test_case append_c_output
+append_c_output_head() {
+atf_set "descr" "Verify that echo(1) does not print the trailing 
newline " \
+"character when '\c' is appended to the end of the string"
+}
+
+append_c_output_body() {
+atf_check -s ignore -o inline:"Hello world" \
+/bin/echo "Hello world\c"
+}
+
+atf_init_test_cases()
+{
+atf_add_test_case n_output
+atf_add_test_case append_c_output
+}

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Jun  6 14:46:45 2017
(r319625)
+++ head/etc/mtree/BSD.tests.dist   Tue Jun  6 16:04:27 2017
(r319626)
@@ -12,6 +12,8 @@
 ..
 dd
 ..
+echo
+..
 expr
 ..
 ls
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r316311 - in head: lib/libstand sys/boot/geli sys/boot/i386/gptboot sys/boot/i386/loader sys/boot/i386/zfsboot

2017-06-06 Thread Konstantin Belousov
On Tue, Jun 06, 2017 at 03:51:26PM +0200, Hans Petter Selasky wrote:
> On 03/31/17 02:04, Allan Jude wrote:
> > Author: allanjude
> > Date: Fri Mar 31 00:04:32 2017
> > New Revision: 316311
> > URL: https://svnweb.freebsd.org/changeset/base/316311
> > 
> 
> 
> > 
> > Modified: head/sys/boot/i386/zfsboot/zfsboot.c
> > ==
> > --- head/sys/boot/i386/zfsboot/zfsboot.cThu Mar 30 23:49:57 2017
> > (r316310)
> > +++ head/sys/boot/i386/zfsboot/zfsboot.cFri Mar 31 00:04:32 2017
> > (r316311)
> > @@ -926,7 +926,7 @@ load(void)
> >   zfsargs.primary_pool = primary_spa->spa_guid;
> >   #ifdef LOADER_GELI_SUPPORT
> >   bcopy(gelipw, zfsargs.gelipw, sizeof(zfsargs.gelipw));
> > -bzero(gelipw, sizeof(gelipw));
> > +explicit_bzero(gelipw, sizeof(gelipw));
> >   #else
> >   zfsargs.gelipw[0] = '\0';
> >   #endif
> > 
> 
> Hi Allan,
> 
> For ARM platforms you'll need to do a write memory barrier before the 
> explicit_bzero() returns, else the memory can be recovered by 
> invalidating the memory area by the next thread which is allocating this 
> memory ???
Note that loader execution is single threaded / single core.  As is,
it is not possible for the cache invalidation targeting the generic memory 
in loader to occur.

That said, if we consider usage of the explicit_bzero() in more complete
environment, then a memory barrier is definitely useless for the stated
purpose. After the writing thread issued a barrier, cache is not flushed
to RAM. In other words, cache flush is probably worth doing there, as
you noted.

But this raises a question, shouldn't the explicit_bzero() implementation
handle the cache flush ?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319621 - head/release

2017-06-06 Thread Glen Barber
Author: gjb
Date: Tue Jun  6 14:08:54 2017
New Revision: 319621
URL: https://svnweb.freebsd.org/changeset/base/319621

Log:
  Ensure ${_CW} is uppercase when passing '-c' to mk-vmimage.sh,
  otherwise with 'CLOUDWARE=vagrant-virtualbox', the path to the
  configuration file may be incorrect.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile.vm

Modified: head/release/Makefile.vm
==
--- head/release/Makefile.vmTue Jun  6 10:12:58 2017(r319620)
+++ head/release/Makefile.vmTue Jun  6 14:08:54 2017(r319621)
@@ -59,7 +59,7 @@ cw-${_CW:tl}:
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
-i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW:tu}_FORMAT} 
\
-   -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}IMAGE} -c ${${_CW}CONF}
+   -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}IMAGE} -c 
${${_CW:tu}CONF}
touch ${.TARGET}
 
 cw${_CW:tl}-package:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r316311 - in head: lib/libstand sys/boot/geli sys/boot/i386/gptboot sys/boot/i386/loader sys/boot/i386/zfsboot

2017-06-06 Thread Hans Petter Selasky

On 03/31/17 02:04, Allan Jude wrote:

Author: allanjude
Date: Fri Mar 31 00:04:32 2017
New Revision: 316311
URL: https://svnweb.freebsd.org/changeset/base/316311






Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cThu Mar 30 23:49:57 2017
(r316310)
+++ head/sys/boot/i386/zfsboot/zfsboot.cFri Mar 31 00:04:32 2017
(r316311)
@@ -926,7 +926,7 @@ load(void)
  zfsargs.primary_pool = primary_spa->spa_guid;
  #ifdef LOADER_GELI_SUPPORT
  bcopy(gelipw, zfsargs.gelipw, sizeof(zfsargs.gelipw));
-bzero(gelipw, sizeof(gelipw));
+explicit_bzero(gelipw, sizeof(gelipw));
  #else
  zfsargs.gelipw[0] = '\0';
  #endif



Hi Allan,

For ARM platforms you'll need to do a write memory barrier before the 
explicit_bzero() returns, else the memory can be recovered by 
invalidating the memory area by the next thread which is allocating this 
memory ???


--HPS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319620 - head/sys/compat/linuxkpi/common/src

2017-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun  6 10:12:58 2017
New Revision: 319620
URL: https://svnweb.freebsd.org/changeset/base/319620

Log:
  Fix init order in the LinuxKPI for IDR support after recent changes.
  
  CPU_FOREACH() is not available until SI_SUB_CPU at SI_ORDER_ANY
  when the LinuxKPI is loaded as part of the kernel.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_idr.c

Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c
==
--- head/sys/compat/linuxkpi/common/src/linux_idr.c Tue Jun  6 09:43:28 
2017(r319619)
+++ head/sys/compat/linuxkpi/common/src/linux_idr.c Tue Jun  6 10:12:58 
2017(r319620)
@@ -96,7 +96,7 @@ idr_preload_init(void *arg)
spin_lock_init(>lock);
}
 }
-SYSINIT(idr_preload_init, SI_SUB_LOCK, SI_ORDER_FIRST, idr_preload_init, NULL);
+SYSINIT(idr_preload_init, SI_SUB_CPU, SI_ORDER_ANY, idr_preload_init, NULL);
 
 static void
 idr_preload_uninit(void *arg)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"