Opened 12 years ago

Closed 11 years ago

#5675 closed defect (fixed)

Auto browser open of notebook does not open to a valid url when interface=""

Reported by: was Owned by: boothby
Priority: major Milestone: sage-4.3.2
Component: notebook Keywords:
Cc: acleone Merged in: sagenb-0.7
Authors: Tim Dumol Reviewers: Alex Leone
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by timdumol)

On Thu, 02 Apr 2009 at 11:53PM -0700, Ondrej Certik wrote:
>
> Hi,
>
[...]
> sage: notebook(secure=False, address="")
> [...]
>
> and it starts firefox on the local machine with this address:
>
> http://[www.:8000.com]/?startup_token=41e2a34e89e40139333a8113e9be2a50
>
> which obviously fails. This also happens with sage 3.2.3 (I didn't try
> other versions).

This has been around for a while; I haven't filed a ticket for it, since
I just retype the URL.

It used to be in the notebook that address="" was an error. Then when we switched to twisted, it suddenly meant "listen on all interfaces". Now it's a common option to give.

Attachments (1)

trac_5675-address-launch.patch (862 bytes) - added by timdumol 11 years ago.
This sets the hostname to localhost if interface="" when launching the page

Download all attachments as: .zip

Change History (8)

comment:1 Changed 12 years ago by mpatel

This ticket subsumes #5263.

comment:2 Changed 11 years ago by mpatel

  • Report Upstream set to N/A

There is socket.getfqdn, but does it help? On boxen:

sage: import socket
sage: socket.getfqdn()
'localhost'
sage: socket.gethostbyname_ex(socket.gethostname())
('localhost', ['boxen', 'boxen'], ['127.0.0.1', '128.208.160.197'])

On a local Linux machine, I get

sage: import socket
sage: socket.getfqdn()
'localhost.localdomain'
sage: socket.gethostbyname_ex(socket.gethostname())
('localhost.localdomain', ['localhost', 'foo'], ['127.0.0.1'])

all of which happen to be in /etc/hosts.

What if we just add an option published_host='' (or a variation) and insert it into URLs for published (and remote!) worksheets when interface=''? We could print a warning or raise an error, if both are left empty.

comment:3 Changed 11 years ago by timdumol

  • Description modified (diff)
  • Summary changed from notebook with address="" option should set the address to something useful to Auto browser open of notebook does not open to a valid url when interface=""

Renaming this to a more appropriate title.

Changed 11 years ago by timdumol

This sets the hostname to localhost if interface="" when launching the page

comment:4 Changed 11 years ago by timdumol

  • Authors set to Tim Dumol
  • Status changed from new to needs_review

This fixes the issue described.

comment:5 Changed 11 years ago by acleone

  • Cc acleone added
  • Reviewers set to Alex Leone
  • Status changed from needs_review to positive_review

LGTM. See #5263. This bug is only for a blank option passed to sage -n interface=''.

comment:6 Changed 11 years ago by acleone

I see a few cases:

  1. The user starts the server on his/her computer. localhost works fine
  2. The user starts the server on a network computer via ssh, in which case the browser should probably auto-open to whatever address the user used to ssh into computer. However we can't get this information, and last time I tried firefox doesn't open anyway (when starting the notebook in an ssh session).

See #5263 for the publish url bug.

comment:7 Changed 11 years ago by mpatel

  • Merged in set to sagenb-0.7
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.