[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 23.0.50; open-network-stream should return an error when SERVICE is
From: |
Luca Capello |
Subject: |
Re: 23.0.50; open-network-stream should return an error when SERVICE is a string number |
Date: |
Thu, 20 Sep 2007 16:05:56 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
Hello!
On Thu, 20 Sep 2007 04:46:51 +0200, Glenn Morris wrote:
> Richard Stallman wrote:
>
>> Would someone please DTRT and ack?
>
> I've installed a doc fix.
I saw the fix is in `socks-open-network-stream' [1]. While this
indeed improves the error handling, this doesn't address the issue:
`socks-open-network-stream' correctly behaves WRT the documentation
(SERVICE should be either an integer or a string service), which is
not the case for `open-network-stream' (as the title of this bug).
Please reconsider the whole problem and be consistent with the
behavior of `socks-open-network-stream' instead. Or we should change
the documentation and in that case modify `socks-open-network-stream',
but I still think that the former is the solution.
I see two possibilities:
1) we generalize `socks-find-services-entry' (something like
`find-network-services-entry') and use the same (if ...) in
`open-network-stream'. This is my preferred solution, because it
means less duplicate code...
2) we modify `open-network-stream' like the following dirty hack:
--8<---------------cut here---------------start------------->8---
--- subr.el 02 Sep 2007 01:55:11 +0200 1.564
+++ subr.el 20 Sep 2007 09:13:09 +0200
@@ -1556,6 +1556,9 @@
HOST is name of the host to connect to, or its IP address.
SERVICE is name of the service desired, or an integer specifying
a port number to connect to."
+ (when (and (stringp service)
+ (not (eq 0 (string-to-number service))))
+ (error "SERVICE should be an integer or a service string, not a string
number."))
(make-network-process :name name :buffer buffer
:host host :service service)))
--8<---------------cut here---------------end--------------->8---
I can implement the first solution ;-)
BTW, I didn't propose the two solutions before because:
a) I wasn't sure this is a bug
b) I think the real problem is `make-network-process':
=====
ELISP> (make-network-process :name "http-www.gnu.org" :buffer nil
:host "www.gnu.org" :service "80")
#<process http-www.gnu.org>
ELISP> (make-network-process :name "http-www.gnu.org" :buffer nil
:host "www.gnu.org" :service 80)
#<process http-www.gnu.org<1>>
ELISP> (make-network-process :name "http-www.gnu.org" :buffer nil
:host "www.gnu.org" :service "www")
#<process http-www.gnu.org<2>>
ELISP>
=====
The first one should return an error as well:
=====
make-network-process is a built-in function in `C source code'.
(make-network-process &rest ARGS)
[...]
:service SERVICE -- SERVICE is name of the service desired, or an
integer specifying a port number to connect to. If SERVICE is t,
a random port number is selected for the server.
=====
Thx, bye,
Gismo / Luca
Footnotes:
[1] http://cvs.sv.gnu.org/viewvc/emacs/emacs/lisp/net/socks.el?r1=1.5&r2=1.6