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

Incorrect handling of § in copyrights #3667

Closed
stefan6419846 opened this issue Feb 23, 2024 · 2 comments
Closed

Incorrect handling of § in copyrights #3667

stefan6419846 opened this issue Feb 23, 2024 · 2 comments
Labels

Comments

@stefan6419846
Copy link

Description

Having a § in a copyright line throws off the parser and yields unexpected results.

How To Reproduce

>>> from scancode import api
>>> api.get_copyrights("androidx.appcompat_appcompat_1.6.1/res/color-v23/abc_tint_btn_checkable.xml")
{'copyrights': [{'copyright': 'Copyright (c) 2016SS The Android Open Source Project', 'start_line': 3, 'end_line': 3}], 'holders': [{'holder': '2016SS The Android Open Source Project', 'start_line': 3, 'end_line': 3}], 'authors': []}
>>> 

The corresponding XML file is:

<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016§ The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:color="?attr/colorControlNormal" android:alpha="?android:disabledAlpha"/>
    <item android:state_checked="true" android:color="?attr/colorControlActivated"/>
    <item android:color="?attr/colorControlNormal"/>
</selector>

System configuration

  • What OS are you running on? Ubuntu 22.04
  • What version of scancode-toolkit was used to generate the scan file? 32.0.8
  • What installation method was used to install/run scancode? pip
@pombredanne
Copy link
Member

pombredanne commented Feb 23, 2024

Thanks... a most bizarre issue! This looks rare enough but easy to fix. The section sign (§) https://en.wikipedia.org/wiki/Section_sign has really no interesting meaning here and gets transliterated to SS which is not super happy. The simple way out will be to replace these by a space in the text cleanup step before the copryight parsing.

pombredanne added a commit that referenced this issue Feb 24, 2024
Reference: #3667
Reported-by: Stefan @stefan6419846
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@stefan6419846
Copy link
Author

Released in version 32.1.0, thus closing this issue.

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

2 participants