Skip to content

Commit

Permalink
Fix binary gibberish bug on extra newlines
Browse files Browse the repository at this point in the history
Regen test expectations for this and also fix another test.

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
  • Loading branch information
AyanSinhaMahapatra committed Oct 13, 2022
1 parent a7cc2d5 commit 8a8fba0
Show file tree
Hide file tree
Showing 56 changed files with 99 additions and 145 deletions.
4 changes: 2 additions & 2 deletions src/licensedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def load(self, license_file, check_consistency=True):

self.text = ''
else:
self.text = post.content
self.text = post.content.lstrip()

for k, v in data.items():
if k == 'minimum_coverage':
Expand Down Expand Up @@ -1927,7 +1927,7 @@ def load(self, rule_file, with_checks=True):
f'{self}: file://{rule_file}'
)

self.text = post.content
self.text = post.content.lstrip()

except Exception as e:
print('#############################')
Expand Down
24 changes: 12 additions & 12 deletions tests/licensedcode/data/license_db/index.json-expected.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ text_urls:
- https://git.savannah.gnu.org/cgit/bash.git/plain/COPYING?h=bash-3.0-rc1&id=dd9e6dfa23d0dae4888f11fb8c6a27bc36d1b283
---

b'\nThe Free Software Foundation has exempted Bash from the requirement of\nParagraph 2c of the General Public License. This is to say, there is\nno requirement for Bash to print a notice when it is started\ninteractively in the usual way. We made this exception because users\nand standards expect shells not to print such messages. This\nexception applies to any program that serves as a shell and that is\nbased primarily on Bash as opposed to other GNU software.'
b'The Free Software Foundation has exempted Bash from the requirement of\nParagraph 2c of the General Public License. This is to say, there is\nno requirement for Bash to print a notice when it is started\ninteractively in the usual way. We made this exception because users\nand standards expect shells not to print such messages. This\nexception applies to any program that serves as a shell and that is\nbased primarily on Bash as opposed to other GNU software.'
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@
<dt style="">text</dt>
<dd>


The Free Software Foundation has exempted Bash from the requirement of
The Free Software Foundation has exempted Bash from the requirement of
Paragraph 2c of the General Public License. This is to say, there is
no requirement for Bash to print a notice when it is started
interactively in the usual way. We made this exception because users
Expand All @@ -145,8 +144,7 @@

</dl>
<div class="text-bold">license_text</div>
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>
The Free Software Foundation has exempted Bash from the requirement of
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>The Free Software Foundation has exempted Bash from the requirement of
Paragraph 2c of the General Public License. This is to say, there is
no requirement for Bash to print a notice when it is started
interactively in the usual way. We made this exception because users
Expand All @@ -164,7 +162,7 @@
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.1.0 on Sep 28, 2022.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.2.1 on Oct 14, 2022.</p>
</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"text_urls": [
"https://git.savannah.gnu.org/cgit/bash.git/plain/COPYING?h=bash-3.0-rc1&id=dd9e6dfa23d0dae4888f11fb8c6a27bc36d1b283"
],
"text": "\nThe Free Software Foundation has exempted Bash from the requirement of\nParagraph 2c of the General Public License. This is to say, there is\nno requirement for Bash to print a notice when it is started\ninteractively in the usual way. We made this exception because users\nand standards expect shells not to print such messages. This\nexception applies to any program that serves as a shell and that is\nbased primarily on Bash as opposed to other GNU software."
"text": "The Free Software Foundation has exempted Bash from the requirement of\nParagraph 2c of the General Public License. This is to say, there is\nno requirement for Bash to print a notice when it is started\ninteractively in the usual way. We made this exception because users\nand standards expect shells not to print such messages. This\nexception applies to any program that serves as a shell and that is\nbased primarily on Bash as opposed to other GNU software."
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spdx_license_key: LicenseRef-scancode-bash-exception-gpl-2.0
text_urls:
- https://git.savannah.gnu.org/cgit/bash.git/plain/COPYING?h=bash-3.0-rc1&id=dd9e6dfa23d0dae4888f11fb8c6a27bc36d1b283
text: |
The Free Software Foundation has exempted Bash from the requirement of
Paragraph 2c of the General Public License. This is to say, there is
no requirement for Bash to print a notice when it is started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ homepage_url: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-fir
spdx_license_key: LicenseRef-scancode-binary-linux-firmware
---

b'\nRedistribution. Redistribution and use in binary form, without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions must reproduce the above copyright notice and the\nfollowing disclaimer in the documentation and/or other materials\nprovided with the distribution.\n\n* Neither the name of the Copyright Holder nor the names of its\nsuppliers may be used to endorse or promote products derived from this\nsoftware without specific prior written permission.\n\n* No reverse engineering, decompilation, or disassembly of this software\nis permitted.\n\nDISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\nCONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\nUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE'
b'Redistribution. Redistribution and use in binary form, without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions must reproduce the above copyright notice and the\nfollowing disclaimer in the documentation and/or other materials\nprovided with the distribution.\n\n* Neither the name of the Copyright Holder nor the names of its\nsuppliers may be used to endorse or promote products derived from this\nsoftware without specific prior written permission.\n\n* No reverse engineering, decompilation, or disassembly of this software\nis permitted.\n\nDISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\nCONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\nUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE'
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@
<dt style="">text</dt>
<dd>


Redistribution. Redistribution and use in binary form, without
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:

Expand Down Expand Up @@ -148,8 +147,7 @@

</dl>
<div class="text-bold">license_text</div>
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>
Redistribution. Redistribution and use in binary form, without
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:

Expand Down Expand Up @@ -186,7 +184,7 @@
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.1.0 on Sep 28, 2022.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.2.1 on Oct 14, 2022.</p>
</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"owner": "Unspecified",
"homepage_url": "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/",
"spdx_license_key": "LicenseRef-scancode-binary-linux-firmware",
"text": "\nRedistribution. Redistribution and use in binary form, without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions must reproduce the above copyright notice and the\nfollowing disclaimer in the documentation and/or other materials\nprovided with the distribution.\n\n* Neither the name of the Copyright Holder nor the names of its\nsuppliers may be used to endorse or promote products derived from this\nsoftware without specific prior written permission.\n\n* No reverse engineering, decompilation, or disassembly of this software\nis permitted.\n\nDISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\nCONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\nUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE"
"text": "Redistribution. Redistribution and use in binary form, without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions must reproduce the above copyright notice and the\nfollowing disclaimer in the documentation and/or other materials\nprovided with the distribution.\n\n* Neither the name of the Copyright Holder nor the names of its\nsuppliers may be used to endorse or promote products derived from this\nsoftware without specific prior written permission.\n\n* No reverse engineering, decompilation, or disassembly of this software\nis permitted.\n\nDISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\nCONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\nUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ owner: Unspecified
homepage_url: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/
spdx_license_key: LicenseRef-scancode-binary-linux-firmware
text: |
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ standard_notice: |
Bison.
---

b'\nAs a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.'
b'As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.'
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@
<dt style="">text</dt>
<dd>


As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.
As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.

</dd>

</dl>
<div class="text-bold">license_text</div>
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>
As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.</code></pre>
<pre id="license-text" class="code mt-1" style="white-space: pre-wrap;"><code>As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.</code></pre>
</div>

<div class="container">
Expand All @@ -165,7 +163,7 @@
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.1.0 on Sep 28, 2022.</p>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 31.2.1 on Oct 14, 2022.</p>
</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"spdx_license_key": "LicenseRef-scancode-bison-exception-2.0",
"faq_url": "http://www.gnu.org/software/bison/manual/bison.html#Conditions",
"standard_notice": "This library is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\nThis library is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\nmore details.\nYou should have received a copy of the GNU General Public License along\nwith this library; see the file COPYING. If not, write to the Free Software\nFoundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\nAs a special exception, when this file is copied by Bison into a Bison\noutput file, you may use that output file without restriction. This special\nexception was added by the Free Software Foundation in version 1.24 of\nBison.\n",
"text": "\nAs a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison."
"text": "As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison."
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ standard_notice: |
output file, you may use that output file without restriction. This special
exception was added by the Free Software Foundation in version 1.24 of
Bison.
text: |
As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison.
text: As a special exception, when this file is copied by Bison into a Bison output file, you
may use that output file without restriction. This special exception was added by the Free
Software Foundation in version 1.24 of Bison.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ standard_notice: |
2.2 of Bison.
---

b"\nAs a special exception, you may create a larger work that contains part or all\nof the Bison parser skeleton and distribute that work under terms of your\nchoice, so long as that work isn't itself a parser generator using the skeleton\nor a modified version thereof as a parser skeleton. Alternatively, if you\nmodify or redistribute the parser skeleton itself, you may (at your option)\nremove this special exception, which will cause the skeleton and the resulting\nBison output files to be licensed under the GNU General Public License without\nthis special exception.\n\nThis special exception was added by the Free Software Foundation in version 2.2\nof Bison."
b"As a special exception, you may create a larger work that contains part or all\nof the Bison parser skeleton and distribute that work under terms of your\nchoice, so long as that work isn't itself a parser generator using the skeleton\nor a modified version thereof as a parser skeleton. Alternatively, if you\nmodify or redistribute the parser skeleton itself, you may (at your option)\nremove this special exception, which will cause the skeleton and the resulting\nBison output files to be licensed under the GNU General Public License without\nthis special exception.\n\nThis special exception was added by the Free Software Foundation in version 2.2\nof Bison."
Loading

0 comments on commit 8a8fba0

Please sign in to comment.