bug#3736: 23.1.50; Please use null-device instead of /dev/null

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
Lennart Borgman <[hidden email]> writes:

> There are nearly a hundred places in Emacs lisp sources where
> /dev/null is used instead of null-device. Please convert those to use
> null-device so that it gets system-independent. (I wonder what to do
> with those in Tramp.)

On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
"/dev/null" on remote machines.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Jason Rumney-4
Michael Albinus wrote:

> On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
> "/dev/null" on remote machines.
>  

What if the remote machine uses "NUL", "NLA0:" or "Dev:Nul" for its null
device? I think tramp benefits from the use of null-device instead of
hard-coded "/dev/null" as much as any other part of Emacs.




Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Sven Joachim
On 2009-07-02 15:03 +0200, Jason Rumney wrote:

> Michael Albinus wrote:
>
>> On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
>> "/dev/null" on remote machines.
>>  
>
> What if the remote machine uses "NUL", "NLA0:" or "Dev:Nul" for its
> null device? I think tramp benefits from the use of null-device
> instead of hard-coded "/dev/null" as much as any other part of Emacs.

Not really, you know what null-device should be for the local machine,
but not for remote computers.

Sven



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Jason Rumney-4
Sven Joachim wrote:
> Not really, you know what null-device should be for the local machine,
> but not for remote computers.
>  

Probably the best solution is for tramp to implement a general
server-local-variable mechanism, as there are probably other variables
that need different values for different servers too.  The user could
then configure a variable (such as tramp-server-local-variable-alist) to
define any such variables that they need to, which would then be let
bound as appropriate in tramp functions.





Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Lennart Borgman (gmail)
In reply to this post by Sven Joachim
On Thu, Jul 2, 2009 at 3:57 PM, Sven Joachim<[hidden email]> wrote:

> On 2009-07-02 15:03 +0200, Jason Rumney wrote:
>
>> Michael Albinus wrote:
>>
>>> On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
>>> "/dev/null" on remote machines.
>>>
>>
>> What if the remote machine uses "NUL", "NLA0:" or "Dev:Nul" for its
>> null device? I think tramp benefits from the use of null-device
>> instead of hard-coded "/dev/null" as much as any other part of Emacs.
>
> Not really, you know what null-device should be for the local machine,
> but not for remote computers.

Does not the remote computer identify itself so that it is possible to
at least make a better guess?



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
In reply to this post by Jason Rumney-4
Jason Rumney <[hidden email]> writes:

>> On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
>> "/dev/null" on remote machines.
>
> What if the remote machine uses "NUL", "NLA0:" or "Dev:Nul" for its
> null device? I think tramp benefits from the use of null-device
> instead of hard-coded "/dev/null" as much as any other part of Emacs.

In case Tramp uses "/dev/null", the remote machine is expected to be
unixish. For other remote machine types, "/dev/null" is not used.

I would not carve this sentence in stone, but that's the situation
today.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
In reply to this post by Jason Rumney-4
Jason Rumney <[hidden email]> writes:

> Probably the best solution is for tramp to implement a general
> server-local-variable mechanism, as there are probably other variables
> that need different values for different servers too.  The user could
> then configure a variable (such as tramp-server-local-variable-alist)
> to define any such variables that they need to, which would then be
> let bound as appropriate in tramp functions.

Nice idea. Tramp does it already in some cases (for example for
environment variables of the remote host), but your proposal is more
general.

Noted.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Eli Zaretskii
In reply to this post by Michael Albinus
> From: Michael Albinus <[hidden email]>
> Date: Thu, 02 Jul 2009 14:22:38 +0200
> Cc: [hidden email], [hidden email]
>
> Lennart Borgman <[hidden email]> writes:
>
> > There are nearly a hundred places in Emacs lisp sources where
> > /dev/null is used instead of null-device. Please convert those to use
> > null-device so that it gets system-independent. (I wonder what to do
> > with those in Tramp.)
>
> On W32 systems, null-device is "NUL". Not useful for Tramp, it needs
> "/dev/null" on remote machines.

On remote machines, Tramp indeed shouldn't use a value that is correct
for the local OS.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Stefan Kangas
In reply to this post by Michael Albinus
Michael Albinus <[hidden email]> writes:

> Jason Rumney <[hidden email]> writes:
>
>> Probably the best solution is for tramp to implement a general
>> server-local-variable mechanism, as there are probably other variables
>> that need different values for different servers too.  The user could
>> then configure a variable (such as tramp-server-local-variable-alist)
>> to define any such variables that they need to, which would then be
>> let bound as appropriate in tramp functions.
>
> Nice idea. Tramp does it already in some cases (for example for
> environment variables of the remote host), but your proposal is more
> general.
>
> Noted.

(That was 12 years ago.)

Now that we have this concept of "connection local variables", does that
satisfy the requirement to be able to specify null-device for remote
hosts?



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
Stefan Kangas <[hidden email]> writes:

Hi Stefan,

> Michael Albinus <[hidden email]> writes:
>
>> Jason Rumney <[hidden email]> writes:
>>
>>> Probably the best solution is for tramp to implement a general
>>> server-local-variable mechanism, as there are probably other variables
>>> that need different values for different servers too.  The user could
>>> then configure a variable (such as tramp-server-local-variable-alist)
>>> to define any such variables that they need to, which would then be
>>> let bound as appropriate in tramp functions.
>>
>> Nice idea. Tramp does it already in some cases (for example for
>> environment variables of the remote host), but your proposal is more
>> general.
>>
>> Noted.
>
> (That was 12 years ago.)

Thanks for the reminder. Somehow, I've missed to tag this bug locally,
so I've lost it.

> Now that we have this concept of "connection local variables", does that
> satisfy the requirement to be able to specify null-device for remote
> hosts?

Yes, shall be possible. I'll see what I could do (with slow progress, as
it happens these days to me). Target will be Emacs 28.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
Michael Albinus <[hidden email]> writes:

Hi Stefan,

>>>> Probably the best solution is for tramp to implement a general
>>>> server-local-variable mechanism, as there are probably other variables
>>>> that need different values for different servers too.  The user could
>>>> then configure a variable (such as tramp-server-local-variable-alist)
>>>> to define any such variables that they need to, which would then be
>>>> let bound as appropriate in tramp functions.
>>>
>>> Nice idea. Tramp does it already in some cases (for example for
>>> environment variables of the remote host), but your proposal is more
>>> general.
>
>> Now that we have this concept of "connection local variables", does that
>> satisfy the requirement to be able to specify null-device for remote
>> hosts?
>
> Yes, shall be possible. I'll see what I could do (with slow progress, as
> it happens these days to me). Target will be Emacs 28.

I've added the functions null-device and path-separator, which return
the connection-local values of the respective variables. As first shot,
I've changed grep.el using this. Let's see whether there's
feedback. However, people will see a difference only if they work on a
local w32 system, and apply Emacs's grep command on a remote machine --
a constellation I cannot test myself.

I'll continue to adapt other Emacs Lisp files.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Michael Albinus
Michael Albinus <[hidden email]> writes:

Hi Stefan,

> I've added the functions null-device and path-separator, which return
> the connection-local values of the respective variables. As first shot,
> I've changed grep.el using this. Let's see whether there's
> feedback. However, people will see a difference only if they work on a
> local w32 system, and apply Emacs's grep command on a remote machine --
> a constellation I cannot test myself.
>
> I'll continue to adapt other Emacs Lisp files.

I have applied all respective changes in the master branch which look
obvious to me. There are still ~40 occurences of /dev/null in the lisp
directory, but most of them are comments. So I'll close this bug.

If people are interested in fixing the few other places, they could do
now by using the null-device variable or function. In case they don't
know what's better, a new bug report for the given case would do,
instead of keeping *this* bug report open forever.

Best regards, Michael.



Reply | Threaded
Open this post in threaded view
|

bug#3736: 23.1.50; Please use null-device instead of /dev/null

Stefan Kangas
Michael Albinus <[hidden email]> writes:

> I have applied all respective changes in the master branch which look
> obvious to me. There are still ~40 occurences of /dev/null in the lisp
> directory, but most of them are comments. So I'll close this bug.

Thanks for taking care of all that.

> If people are interested in fixing the few other places, they could do
> now by using the null-device variable or function. In case they don't
> know what's better, a new bug report for the given case would do,
> instead of keeping *this* bug report open forever.

Sounds reasonable.