Commit 12650d3
committed
Remove current directory from the default used when PATH is unset
* dialog.py (_find_in_path): in case PATH was unset, the default value
used to start with a colon, which caused pythondialog to look for the
executable in the current directory if (1) the specified executable
didn't contain a '/' and (2) the PATH environment variable was unset.
This behavior was conformant to what glibc's execvp() function did until
version 2.24 from 2016, but wasn't ideal (if a pythondialog-based
program had its current directory world-writable, this could be used to
trap users whose PATH is unset---which is rather unlikely, fortunately).
This suboptimal default behavior when PATH is unset was changed in glibc
2.24, and we are following suit here, i.e., the new default is
"/bin:/usr/bin". Also clarify the docstring.
* dialog.py (_path_to_executable): return the result after applying
os.path.realpath() and clarify the docstring. Using os.path.realpath()
at this point ensures that the path to the dialog-like executable is
resolved at the time the Dialog instance is created. This way, a
pythondialog-based program can change its current directory after
creating a Dialog instance without fearing that this might cause
subsequent pythondialog calls to fail or to invoke an executable from a
different directory.
* dialog.py (Dialog.__init__): adapt the docstring to reflect the
aforementioned change when PATH is unset (as mentioned above for
_find_in_path()).
(cherry picked from commit 94c2702)1 parent 1a3b087 commit 12650d3
2 files changed
+23
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
433 | 433 | | |
434 | | - | |
435 | | - | |
| 434 | + | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
444 | | - | |
445 | | - | |
| 443 | + | |
446 | 444 | | |
447 | 445 | | |
448 | 446 | | |
| |||
455 | 453 | | |
456 | 454 | | |
457 | 455 | | |
458 | | - | |
| 456 | + | |
459 | 457 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
464 | 463 | | |
465 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
466 | 467 | | |
467 | 468 | | |
468 | 469 | | |
| |||
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
475 | | - | |
476 | | - | |
| 476 | + | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
909 | 910 | | |
910 | 911 | | |
911 | 912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
0 commit comments