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

"c++" tag is slugified as "c", causing false aliasing and breaking build with obtuse traceback #1344

Closed
mikemccracken opened this issue Jun 27, 2014 · 11 comments
Assignees
Labels
Milestone

Comments

@mikemccracken
Copy link

Scanning posts.Traceback (most recent call last):
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/doit/doit_cmd.py", line 120, in run
    return command.parse_execute(args)
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/doit/cmd_base.py", line 78, in parse_execute
    return self.execute(params, args)
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/doit/cmd_base.py", line 245, in execute
    args)
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/nikola/__main__.py", line 220, in load_tasks
    self.nikola.gen_tasks('render_site', "Task", 'Group of tasks to render the site.'))
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/doit/loader.py", line 256, in generate_tasks
    for task_dict, x_doc in flat_generator(gen_result, gen_doc):
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/doit/loader.py", line 26, in flat_generator
    for item in gen:
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/nikola/nikola.py", line 1104, in gen_tasks
    for task in flatten(pluginInfo.plugin_object.gen_tasks()):
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/nikola/nikola.py", line 1098, in flatten
    for t in task:
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/nikola/plugins/task/archive.py", line 53, in gen_tasks
    self.site.scan_posts()
  File "/home/mmccrack/weblog/NIKOLA/local/lib/python2.7/site-packages/nikola/nikola.py", line 1205, in scan_posts
    other_tag = [k for k in self.posts_per_tag.keys() if k.lower() == tag.lower()][0]
IndexError: list index out of range
@Kwpolska Kwpolska added the bug label Jun 27, 2014
@Kwpolska Kwpolska added this to the v7.0.2 milestone Jun 27, 2014
@Kwpolska Kwpolska self-assigned this Jun 27, 2014
@Kwpolska
Copy link
Member

Don’t differentiate between the two [solved].

Allowing every single character in existence might not be the easiest (nor sanest!) thing to do. We can try, though…

And the traceback itself to be handled in #1343.

@mikemccracken
Copy link
Author

Sorry, I don't really understand your first comment. Is it solved in the
current master, or in some other code?
Or were you describing something I need to do to solve it? In which case,
that wasn't clear.

I worked around it by changing the tag to c-plus-plus, which is lame but
I'm not mad about it.

I won't argue for supporting every character, but if the slugified version
of a tag is not the same length as the current tag (or some other measure
of 'significantly different'), there should be a warning that shows them
both, IMO.

On Fri, Jun 27, 2014 at 8:04 AM, Chris “Kwpolska” Warrick <
notifications@github.com> wrote:

Don’t differentiate between the two [solved].

Allowing every single character in existence might not be the easiest (nor
sanest!) thing to do. We can try, though…

And the traceback itself to be handled in #1343
#1343.


Reply to this email directly or view it on GitHub
#1344 (comment).

@ralsina
Copy link
Member

ralsina commented Jun 27, 2014

On 27/06/14 13:59, Michael McCracken wrote:

Sorry, I don't really understand your first comment. Is it solved in the
current master, or in some other code?
Or were you describing something I need to do to solve it? In which case,
that wasn't clear.

I worked around it by changing the tag to c-plus-plus, which is lame but
I'm not mad about it.

I won't argue for supporting every character, but if the slugified
version
of a tag is not the same length as the current tag (or some other measure
of 'significantly different'), there should be a warning that shows them
both, IMO.

What we need to do is notice if two tags, when slugified, match each
other and give a reasonable error. I thought there was code for it...

@Kwpolska
Copy link
Member

What we need to do is notice if two tags, when slugified, match each other and give a reasonable error. I thought there was code for it...

There is — and it’s now broken (see #1343).

Sorry, I don't really understand your first comment. Is it solved in the current master, or in some other code?
Or were you describing something I need to do to solve it? In which case, that wasn't clear.

My “solution” was: nuke one of the tags.

@Kwpolska
Copy link
Member

A “real” solution would involve making + a valid character in a slug. Might not be a good idea.

@ralsina
Copy link
Member

ralsina commented Jun 27, 2014

Yes, there's two problems.

  1. Do we allow "+" in slugs?
  2. Let's give a better error when slugs collapse tags.

@Kwpolska
Copy link
Member

Kwpolska commented Aug 5, 2014

Problem 2 fixed in #1343.

@ralsina
Copy link
Member

ralsina commented Aug 17, 2014

Since "+" is a valid character in URL paths, I see no reason not to allow it in slugs. So, allowing it in upcoming branch.

ralsina added a commit that referenced this issue Aug 17, 2014
ralsina added a commit that referenced this issue Aug 17, 2014
ralsina added a commit that referenced this issue Aug 17, 2014
@ralsina ralsina closed this as completed Aug 17, 2014
@Kwpolska
Copy link
Member

There are many more characters we could allow, why not try to do them too?

Chris “Kwpolska” Warrick http://chriswarrick.com/
Sent from my SGS3.

@ralsina
Copy link
Member

ralsina commented Aug 17, 2014

Usually slugs are defined as letter+number+- ... I added + because there was a good reason, other characters need their own reason, I guess? What characters are we talking about?

@Kwpolska
Copy link
Member

It's hard to think of a good reason right now. Then again, going too far
would pretty much invalidate USE_SLUGIFY.

Chris “Kwpolska” Warrick http://chriswarrick.com/
Sent from my SGS3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants