Skip to content
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

[chanlogs] exceptions with channels that have "/" #490

Closed
bui opened this issue Mar 21, 2014 · 3 comments
Closed

[chanlogs] exceptions with channels that have "/" #490

bui opened this issue Mar 21, 2014 · 3 comments
Labels
Bug Things to squish; generally used for issues

Comments

@bui
Copy link
Contributor

bui commented Mar 21, 2014

Traceback (most recent call last):
  File "/home/amphy/willie/willie/bot.py", line 747, in call
    exit_code = func(willie, trigger)
  File "/home/amphy/willie/willie/modules/chanlogs.py", line 115, in log_join
    with open(fpath, "a") as f:
IOError: [Errno 2] No such file or directory: u'/vp/-2014-03-21.log'

I imagine there'll be issues with other characters too, so what can be done about this? I believe ZNC's log module replaces special characters with a ? or _, maybe this should be done here?

@tyrope tyrope added the Bug label Mar 21, 2014
@elad661
Copy link
Contributor

elad661 commented Apr 20, 2014

This is an interesting one as the list of forbidden characters depend on the filesystem. Since willie can be run on probably any filesystem out there, we need to figure out a list of blacklisted chars and a map of things to replace them with: what happens if a channel is named #foo/bar and another is named #foo?bar, and willie is running on NTFS? we can't change all forbidden chars to one char, because that will cause conflicts.

We need to figure out a better solution. Perhaps url-encoding channel names when they contain an illegal char?

Obviously for ext2/3/4 filesystems we don't have the conflict problem since there are only two forbidden chars: / and NULL, but willie is cross-platform, and there's the possibility some crazy person out there is running willie on FAT16 from Linux.

@embolalia
Copy link
Contributor

I like the idea of URL encoding, although I don't know whether that would play well serving the log dir over http. Would they end up double-encoded? Still, probably better to just do something to stop the errors, even if there's a better way.

@mshade
Copy link

mshade commented Feb 13, 2015

As much as I hate suggesting this, I think perfect is the enemy of good in this case, and translating "illegal" characters to something common is probably the best approach. The other alternative would be logging to a database by default, or using a checksum of some sort, which both lead to awful discoverability.

Perhaps use something like __ (double underscore) as the substitution? Be very conservative in which "illegal" characters would trigger it.

maxpowa pushed a commit to maxpowa/Inumuta that referenced this issue Feb 20, 2015
This probably works, but tbh I'm just throwing it together and haven't
actually tested it. If it does work, it'll close sopel-irc#490.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Things to squish; generally used for issues
Projects
None yet
Development

No branches or pull requests

5 participants