From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23068: 25.1.50; unix socket address in abstract namespace Date: Sun, 20 Mar 2016 19:25:13 +0200 Message-ID: <83egb56ozq.fsf@gnu.org> References: <87h9g1g7lg.fsf@udel.edu> <83h9g16rfy.fsf@gnu.org> <20160320170212.GA19097@holos.localdomain> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1458494787 4265 80.91.229.3 (20 Mar 2016 17:26:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2016 17:26:27 +0000 (UTC) Cc: mvoteiza@udel.edu, 23068@debbugs.gnu.org To: Lars Magne Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 20 18:26:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahh7E-0006Se-LJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Mar 2016 18:26:12 +0100 Original-Received: from localhost ([::1]:53800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh7D-0002aQ-Un for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Mar 2016 13:26:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh77-0002Za-KP for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 13:26:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahh74-0007OS-Dd for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 13:26:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh74-0007OO-A7 for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 13:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ahh74-0000oW-3y for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 13:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Mar 2016 17:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23068-submit@debbugs.gnu.org id=B23068.14584947493110 (code B ref 23068); Sun, 20 Mar 2016 17:26:02 +0000 Original-Received: (at 23068) by debbugs.gnu.org; 20 Mar 2016 17:25:49 +0000 Original-Received: from localhost ([127.0.0.1]:55779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahh6q-0000o6-Nn for submit@debbugs.gnu.org; Sun, 20 Mar 2016 13:25:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahh6p-0000nu-G4 for 23068@debbugs.gnu.org; Sun, 20 Mar 2016 13:25:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahh6g-0007Ji-EU for 23068@debbugs.gnu.org; Sun, 20 Mar 2016 13:25:42 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:32888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh6g-0007Jc-9X; Sun, 20 Mar 2016 13:25:38 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1386 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ahh6f-0000Jc-Hm; Sun, 20 Mar 2016 13:25:38 -0400 In-reply-to: (message from Lars Magne Ingebrigtsen on Sun, 20 Mar 2016 18:11:09 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:115157 Archived-At: > From: Lars Magne Ingebrigtsen > Cc: Eli Zaretskii , 23068@debbugs.gnu.org > Date: Sun, 20 Mar 2016 18:11:09 +0100 > > Mark Oteiza writes: > > > and I'm able to connect to it otherwise. The above elisp does: > > > > socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0) = 8 > > connect(8, {sa_family=AF_LOCAL, sun_path=@""}, 110) = -1 > > ECONNREFUSED (Connection refused) > > close(8) > > Yeah, this code in conv_lisp_to_sockaddr doesn't look very correct: > > else if (STRINGP (address)) > { > #ifdef HAVE_LOCAL_SOCKETS > if (family == AF_LOCAL) > { > struct sockaddr_un *sockun = (struct sockaddr_un *) sa; > cp = SDATA (address); > for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++) > sockun->sun_path[i] = *cp++; > sa->sa_family = family; > } > #endif > return; > } That should be trivial to fix. Elsewhere, we specifically attempt to support this feature: #ifdef HAVE_LOCAL_SOCKETS case AF_LOCAL: { struct sockaddr_un *sockun = (struct sockaddr_un *) sa; ptrdiff_t name_length = len - offsetof (struct sockaddr_un, sun_path); /* If the first byte is NUL, the name is a Linux abstract socket name, and the name can contain embedded NULs. If it's not, we have a NUL-terminated string. Be careful not to walk past the end of the object looking for the name terminator, however. */ if (name_length > 0 && sockun->sun_path[0] != '\0') { const char *terminator = memchr (sockun->sun_path, '\0', name_length); if (terminator) name_length = terminator - (const char *) sockun->sun_path; } return make_unibyte_string (sockun->sun_path, name_length); } IOW, this is not a wishlist feature request, but a routine bug report ;-)