-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cowpath.d/*.path files add unwanted entries to cowpath #28
Comments
Oops! Blank lines (including nonempty all-whitespace lines, I think) should be ignored. Let's make "#" a special character that is a comment introducer, and backslash-escape it like "
Yes. Though I'd do it slightly different like "strip
Oh, hmm: This sounds like a good approach too. I think all paths in a cowpath should be absolute. (I'll need to review the code.) I'm not sure it makes sense to have relative/non-absolute paths in it, at least in the parts of cowpath that are defined by system or user level config files. Maybe we should even support bash-like |
Common config file properties. Agreed.
String escaping always sounds difficult to implement properly. Easier/safer to entirely avoid it.
I would keep both the description of the file format and the code handling ist as simple as possible, while allowing for common config file properties, e.g.
This allows common config file properties like comments and spacing via empty lines with really simple code, while leaving some more things undefined for possible future extension. Possible problem: While Windows supposedly has at least partial support for
I think the code should actively avoid non-absolute entries to the cowpath.
As cowdirs are dirs to be filled with executable code which cowsay will run, I would think long and hard about the security implications of non-absolute and $HOME based cowdirs before introducing them. Post 3.8.0 maybe? |
Okay, I agree. Because it's incorporating executable code, being conservative is probably the right call. Let's keep it simple, and only "whitelist" known-probably-valid entries like you describe here: "#" is only a comment introducer in column 1; all cowpaths must start with
The Windows kernel and low-level Win32 APIs fully support But crap... I didn't even think that cowsay supported Windows? (At least, in Windows mode; under Cygwin or WSL should be fine, because that looks like Linux.) Crap, gotta do some reading here. |
Sounds good to me, except that syslog is not simple. If it was a new feature, I would
Does cowsay support Windows? I have no idea. I would ask the cowsay maintainer, but you do not have that option. Is there even a Perl on Windows? My last time on a Windows system was in 2003 using MSYS2, so I am not very up to date. Anyway, if you say cowsay is for unix-like systems only, the |
One strong argument against cowsay supporting Windows is cowsay relying on symlinks in the source tree. While allegedly Windows has started supporting symlinks, symlinks appear to work only when the Administrator has explicitly enabled them. |
Symlinks in Windows are an incredible mess. (I know this because I love me some symlinks and have tried repeatedly to make the work on Windows.) They (and junction links) have been supported in NTFS and the core OS for years and years, but AFAICT they're not something Microsoft actually cares about, and almost no other Windows software, including the "upper" levels of Windows itself, is aware of them, so even if an administrator has enabled them, you just know something's gonna break. I would like to stay far away from symlinks on Windows. I wish we had some sort of userbase survey so we could tell if anyone's using cowsay on Windows. And how they're getting it to run? The Googling "cowsay on windows" does produce a bunch of hits. (And cowsay is only $.99 in the Microsoft Store!) We should take a look at those and see what people are doing. #30
Makes sense. Let's warn on stderr. |
I would guess that people do the same thing on/for Windows which the Fedora cowsay package is doing pre-PR#26: Do their own system specific install steps. With the notable difference that I do the Fedora package and upstream its important aspects as PR#26 free of charge, and they charge users 99 cents for the effort and keep their efforts to themselves. |
Scheduling this for 3.9.0. Seems feasible to fix this with a conservative "support blank and comment lines" parsing approach pretty shortly here. I'm just giving up on doing Windows-specific support here, on the basis that Cowsay is supposed to be fun, and packaging up a Windows Perl app does not sound like fun. Someone else can do that, or folks can get this cowsay through WSL, where symlinks work fine AFAICT. :) |
If I have a file in
/etc/cowsay/cowpath.d/foo.path
which is something likethen the empty line makes
cowsay
(version 3.7.0) look for cows in the/
directory.I have verified that
cowsay
looks for cows in/
by putting a special cowfile into/xyz.cow
and then callingdate | cowsay -f xyz
and seeing a cow. If I delete the empty line in the*.path
file, I can rundate | cowsay -f xyz
and see that cowsay cannot find the xyz cow.It appears that if the
*.path
file contains comment lines likeinstalling a cow file as
/# Add the foo cow collection/xyz.cow
, then runningdate | cowsay -f xyz
will not produce a cow, even though aprint join(", ", @cowpath);
after theuniquify_list
line will print a path entry "# Add the foo cow collection".Would it make sense to
$entry
to the cowpath to avoid looking for cows in/
without ever specifying/
to be in the cowpath$entry
values starting with a#
to allow for comment lines?
IIRC this would mean adding two lines after line 121 like
Another way this could be accomplished is by only adding
$entry
values which start with the letter/
(after chomping).Maybe add this after line 121
?
The text was updated successfully, but these errors were encountered: