World: r4wp
[!REBOL3] General discussion about REBOL 3
older newer | first last |
MarcS 10-Mar-2013 [1490x2] | Brief restatement: BROWSE isn't working on OSX -- the current implementation tries two system() calls: xdg-open and x-www-browser |
This patch uses /usr/bin/open on OSX, maintains the previous handlers on other platforms. In addition, I replaced the system() calls with fork+exec to avoid firing up another shell; one byproduct of this is that exec errors no longer print to the console (though this could have been hackishly solved by adding some redirects to the system() call string in the existing codebase). | |
Andreas 10-Mar-2013 [1492] | Did you test this on Linux as well? |
MarcS 10-Mar-2013 [1493] | Not yet, can do so now. |
Andreas 10-Mar-2013 [1494] | Please do. |
MarcS 10-Mar-2013 [1495] | Firing up the VM, give me 5 mins. |
Andreas 10-Mar-2013 [1496] | No hurries :) |
BrianH 10-Mar-2013 [1497] | Look here http://issue.cc/r3/1921before you do this. Make sure the security constraints mentioned there are taken into account. |
MarcS 10-Mar-2013 [1498] | (Works on my Fedora instance.) |
Andreas 10-Mar-2013 [1499x2] | Thanks for testing that. |
Basically: looks fine, thanks a lot for working on this. | |
MarcS 10-Mar-2013 [1501] | BrianH: I don't think this change is an ideal solution, but it seems to be an improvement on prior behaviour. |
Andreas 10-Mar-2013 [1502] | If you can find a way to be more specific on OSX, so that _only_ URLs get handled, that would be great. OTOH, xdg-open is already rather versatile as well (only I fear that OSX's open is even more featureful). |
MarcS 10-Mar-2013 [1503x4] | One problem with the existing implementation is that xdg-open and x-www-browser are searched for in the PATH, so executables with the same names in a PATH directory that takes precedence will yield different behaviour. |
Andreas: yeah, file:/// will open in Finder with this pathc. | |
patch*. | |
(So it's not constrained to the browser.) | |
Andreas 10-Mar-2013 [1507] | That's the same with xdg-open. |
MarcS 10-Mar-2013 [1508] | Right. |
BrianH 10-Mar-2013 [1509] | Yeah. It looks like it just calls open, which can be a bit of a hole. It's better for now but we need to come up with a better solution in the long run. |
MarcS 10-Mar-2013 [1510x3] | Agreed. |
Hmm, why does BROWSE accept NONE? | |
BrianH: I don't mean to present this patch as something it's not. To clarify: still a hacky solution, but at least it brings the current behaviour to OS X. | |
BrianH 10-Mar-2013 [1513] | No, agreed. It's still nowhere near as bad as the #1921 approach, or the last ticket that requested it. But we need to make sure to come up with something better in the long run. |
MarcS 10-Mar-2013 [1514x3] | For sure. |
I might patch this NONE case unless anyone has a good reason to leave it in place? | |
(At the moment, you get usage info on stderr. The current r3 just segfaults on Linux.) | |
BrianH 10-Mar-2013 [1517] | It's none propagation I guess. Because dealing with or ignoring nones is easier to do in Rebol than writing conditional code around everything to avoid triggering errors. |
MarcS 10-Mar-2013 [1518] | Okay, so I guess we just need to handle the NONE rather than attempting to browse it |
BrianH 10-Mar-2013 [1519x3] | The BROWSE code should explicitly do nothing if passed a NONE. It certainly shouldn't segfault. |
If it doesn't explicitly do nothing, that's a bug. | |
Just return unset, I guess. | |
MarcS 10-Mar-2013 [1522x2] | Okay, fixing now. |
not R_NONE? | |
BrianH 10-Mar-2013 [1524] | No, that returns none. Whatever BROWSE normally returns. |
Andreas 10-Mar-2013 [1525] | It normally returns NONE. |
MarcS 10-Mar-2013 [1526] | R_NONE |
Andreas 10-Mar-2013 [1527] | But I think the original intent was for NONE to open an empty browser. Can't find any references for that. |
BrianH 10-Mar-2013 [1528] | Weird. Shouldn't it return unset? |
MarcS 10-Mar-2013 [1529] | https://github.com/rebol/r3/blob/master/src/core/n-io.c#L499 |
Andreas 10-Mar-2013 [1530] | Should probably rather return the URL, that would be more useful :) |
BrianH 10-Mar-2013 [1531] | That treatment of a none argument makes sense, Andreas. However, the function should return unset, like PRINT. |
MarcS 10-Mar-2013 [1532x2] | If we can agree on something, I'll push that the change. |
BrianH: So, R_UNSET? | |
Andreas 10-Mar-2013 [1534] | That's independent of the OSX open fix in any case. |
BrianH 10-Mar-2013 [1535] | Sure. And in the has-a-url case too. |
Andreas 10-Mar-2013 [1536] | So better just file a CC issue for the `browse none` crash, and we can discuss the desired design in there. |
BrianH 10-Mar-2013 [1537] | Yeah, maybe two pulls. |
MarcS 10-Mar-2013 [1538] | Okay, I'll pop this in a separate branch. |
BrianH 10-Mar-2013 [1539] | Marc, did you file a ticket for this? If not, I can repurpose #1921 for this. |
older newer | first last |