8

Someone on reddit asked me if they could republish my sun-hours script I wrote for Ask Ubuntu on their github project.

Just wondering if there is some sort of short form of GPL 3 or 2 line I should put in the bash script? I want to avoid the lengthy multi-paragraph legal blurb you usually see with free usage.

I wanted to update the scripts with recent bug fixes anyways and asked the reddit user to wait until after the week-end to copy sun-hours script. At the same time I'd like to add the short GPL blurb in question.

I wonder what others do for scripts that get republished?


February 18, 2019 Update with sample found

I found this sample here:

#!/bin/bash
#Date and Time Setting Tool Copyright 2009,2011 by Tony Brijeski under the GPL V2

I'm thinking I could use something like this along with link to GPL V2 (or whatever version) license file.


February 17, 2018 Update using @muru's suggestions

I created a git-hub master branch which allows me to select a license file to include by default:

git-hub licenses.gnp

I selected the third option GNU General Public License v3.0

Overall this gives a great platform for publishing your code with catch all licensing. However I still am no closer to a legal one-liner comment to put into each of my bash scripts. The sun-hours script is short so a multi-paragraph legal blurb seems inappropriate in such cases:

$ cat /usr/local/bin/sun-hours
#!/bin/bash

# Called daily from /etc/cron.daily/sun-hours
while true; do

### "-q"= quiet, "-O-" pipe output
echo $(wget -q -O- https://www.timeanddate.com/sun/canada/edmonton | grep -oE 'Sunrise Today.{35}' | awk -F\> '{print $3}' | tr --delete "<") > /tmp/sunrise
echo $(wget -q -O- https://www.timeanddate.com/sun/canada/edmonton | grep -oE 'Sunset Today.{35}' | awk -F\> '{print $3}' | tr --delete "<") > /tmp/sunset

## If network is down files will have one byte size
size1=$(wc -c < /tmp/sunrise)
size2=$(wc -c < /tmp/sunset)

if [ $size1 -gt 1 ] && [ $size2 -gt 1 ] ; then
    cp /tmp/sunrise /usr/local/bin/sunrise
    cp /tmp/sunset  /usr/local/bin/sunset
    chmod 666 /usr/local/bin/sunrise
    chmod 666 /usr/local/bin/sunset
    rm /tmp/sunrise
    rm /tmp/sunset
    exit 0
else
    logger "/etc/cron.daily/sun-hours: Network is down. Waiting 5 minutes to try again."
    sleep 300
fi

done
9
  • 1
  • @dessert Good link thank you. I'd like to take the last line in the question and add the (C) to it for a one-liner on all scripts though. Just something to let people know it's free to use, free to redistribute,etc. But keep the line intact when redistributing. Commented Feb 16, 2018 at 12:45
  • 4
    I don't think this question is in the right place, unless you are asking about the licensing used by Stack Exchange? You seem to be asking a question that would be on topic, say, on Open Source or something
    – Zanna Mod
    Commented Feb 16, 2018 at 13:04
  • Zanna (from my phone with no pinging) I didn't know where to start. So far all my scripts are in Ask Ubuntu though. Commented Feb 16, 2018 at 13:07
  • 2
    @WinEunuuchs2Unix there's two considerations: (1) Licensing of actual code/scripts, (2) Licensing of StackExchange. If you are concerned about the licensing of your code/scripts you should probably publish them in a repo with a specific License on that code. SE posts are licensed under CC BY-SA 3.0 with Attribution so you should probably be very careful if your scripts are only published here, because it's under a CC license as I understand it. (There was discussion on moving code contribs to MIT, but that was shot down in early 2016)
    – Thomas Ward Mod
    Commented Feb 16, 2018 at 14:28
  • 1
    @ThomasWard Oh come on, how is that a comment rather than an answer?
    – dessert
    Commented Feb 17, 2018 at 8:45
  • 1
    @dessert I concur. Which is why I up-voted the comment hint. Commented Feb 17, 2018 at 16:13
  • @Zanna Licensing, reuse of answers, reproduction in compliance with SE license - all of those are in the right place, and there's tons of examples SE meta. This for example Commented Feb 18, 2018 at 5:19
  • @SergiyKolodyazhnyy yeah, agreed
    – Zanna Mod
    Commented Feb 18, 2018 at 6:12

2 Answers 2

10

The CC license family is not recommended for software (see https://opensource.stackexchange.com/q/1717/9554). When I was asked for permission to redistribute one of my scripts, I'd already put it on on GitHub on repository for general purpose scripts, so I clarified that the license on the repository (GPLv2, IIRC) was also applicable on the script and they could redistribute using it. I offered to split it out into its own repo if needed, but that turned out to be unnecessary.

That's what I'd suggest you do too:

  • put it on GitHub or similar code hosting sites - Gitlab, Launchpad, etc.
  • use a clear software license, GPL or MIT or Apache or whichever you like
  • update your post to indicate the repo is the canonical source

Putting it on a code hosting site would be helpful to the redistributor, since now they can use standard VCS tools instead of scraping an Ask Ubuntu post, and makes submission of patches easier.

3
  • As luck would have it I set up a github account about a month ago. I'll see if I can learn enough this family day long weekend. Commented Feb 16, 2018 at 15:49
  • 3
    @WinEunuuchs2Unix Plenty of people in chat who can help you figure it out, if need be :)
    – Seth Mod
    Commented Feb 16, 2018 at 18:32
  • @Seth That's very kind and knowing my thick skull I'll probably need help :) Thank you! Commented Feb 17, 2018 at 0:02
2

Short-form license ?

Just wondering if there is some sort of short form of GPL 3 or 2 line I should put in the bash script?

No, there's no particular short form of that, nor there is a need to do so, and SE sites don't use GPL. (And on side note, most copyright texts state that you have to include copy - that is full copy - of the copyright notice; for example, GPL 3 states: "You should have received a copy of the GNU General Public License along with this program" ) However, what I would recommend doing is to add a comment, couple lines below your script's #! line. Something like this:

#!/usr/bin/env bash
# Written  by WinEunuuchs2Unix <https://askubuntu.com/users/307523>
# https://askubuntu.com/q/894460/295286

Adding such line will explicitly tell others that your content is originally written for Stack Exchange network, and all content on StackExchange Network is CC-BY-SA 3.0 (see the Notes for details). Therefore such line quickly tells that the script is under CC-BY-SA license and whoever is reproducing your code ( be it on reddit or elsewhere ) should give proper attribution. (Note that holds true unless you allowed choosing multiple licenses for your work, see "Practical considerations" section).

How to give attribution is outlined in this SE meta post by Bill the Lizzard, which actually draws from SE Terms of Service:

You must1: A) clearly indicate that it comes from the Stack Exchange Network, and give credit to the author by B) linking to the original answer/question, C) clearly indicating the author(s)' username, and D) providing link(s) to their profile page(s)

See also Jeff Atwood's blog post on the same topic. To be perfectly fair, whoever asked you to republish the code didn't have to ask you so long as the attribution requirements are met, but it is awfully nice of them ( and please note that's just my opinion based on interpreting the attribution requirements).


Practical (maybe slightly depressing) considerations

Let's go on a tangent: Can you license your own answers at all on SE network or can you license via your profile ? Yes, Yes, and Yes. To quote Martijn Pieters's comment: "...the content you post on SO is not exclusively licensed. You are only agreeing to grant a specific license to reuse your work. There is no ownership transfer, the content is still yours to use elsewhere as you please. That gives you the right to do other things with your content, including granting more licenses." Also, as mentioned in answer on our dear moderator Oli's question:

You give up one big thing by posting it here:

  • Your right to stop us (and others who see it here) from sharing it with others who can be helped by it, provided they include the required attribution.

But if you license your answers: - you can't take away rights that SE license gives - additional licenses should be compatible or even more permissive than CC-BY-SA (which is kinda same as the above) - whoever is reusing your work can choose the license by which they will abide, so they can choose to use CC-BY-SE or the other license. If you licensed your code under license that doesn't require attribution, don't be surprised if the user chose that one and didn't give your answer credit.

That said, you mentioned GPL license. The SE license is not GPL compatible as noted in this answer. I wouldn't recommend using GPL, but that's my opinion only. Also, stay away from crayon licenses.

Practically speaking,though, licensing your code on SE answers is a very big, hairy, and uncombed mess.

  • Realistically, there is absolutely nothing stopping anyone from copying and using code without attribution (even if it has license slapped all over it), unless someone starts actually auditing the copied/modified work or calls out the copycat. Enforcing the license also can be problem, especially in case of "crayon licenses" or in case if you reuse your content for actual projects. To quote ArtOfCode:

    Essentially, someone can get my code from somewhere I use it - perhaps in a commercial open-source product of mine - and not attribute it to me. When I chase them down on that, they can simply claim "oh, I got it from Stack Overflow", and get away scot-free

  • There is really no consensus how much is copyrighted and how much is covered by fair use. To quote Jeff Atwood: "...a snippet of code falls under excerpt category and thus should be free to use under fair use. Heck, we don't even support giant masses of code being posted, so to me, by definition, everything would be an excerpt." Problem is that there is no definition of how long is snippet of code. 3 lines ? 10 lines ? Who knows ?

  • Proving original authorship with SE answers can be difficult if not impossible, can even backfire. See this answer for example.

Now because I've sat reading all sorts of sources for over 3 hours now and because I need a break from sitting in front of monitor, I'll leave a few my own opinions in conclusion: treat answers on AskUbuntu as if they are in public domain (even if you will hear everybody on the network say SE is not public domain, because technically public domain is not copyrighted, but SE is copyrighted under permissive license). As 200_success said, "The intention is to share code for discussion, not to give code away". Problem is that one persons intention doesn't prevent another's from just taking code as if it was given away. For inspiration take a look at L.H.O.O.Q.. If you want to really protect code and enforce some sort of license:

  • create MCVE
  • host code on source hosting sites like GitHub, license them appropriately, and link to the code - don't post it into answers
  • provide code in answers which you don't intend to use in serious commercial projects or modify it to suit the commercial project
  • just treat answers as discussion given in good faith that it will be useful to OP (and someone who stumbles upon it).

I'm not a lawyer,though, so treat this answer with grain of salt.


Addressing the "small children" scripts

In your comment you said (emphasis added by me):

By small script I meant those little children the parent script calls. The parent script would still have full license text. The parent is the most important for functionality / intellectual property rights. The children just do small menial little tasks...

OK, pay very very close attention to the highlighted parts, because they will be important. First we need to go back to the very very very basics. Copyright means who owns the code, License - how people are allowed to use that code ( rolfl ). But, to be considered copyrighted, code must be an original work and originality is most important factor ( Aneurysm9 ) .

By that definition, the cron and conky portions that I see in your answer cannot be copyrighted, which means they can't have license. They're just not substantial enough to be considered an original work.

Note also, that there exists something as Abstraction-Comparison-Filtration test to determine substantial similarity. Substantial similarity is actually a legal term. Important part of it, IMHO, is the following:

If there is substantial similarity in ideas, then the trier of fact must decide whether there is substantial similarity in the expressions of the ideas so as to constitute infringement.

In case of cron and conky type of stuff, there is likely chance that there's plenty of cron and conky settings that are very very similar to yours and claiming copyright on them via any license seems slightly ridiculous.

However, you could maybe copyright (in my humble and non-lawyer opinion) the two spinner scripts in your answer for Can BASH display in systray as application indicator?. They seem original enough, although I doubt in an actual court printing four characters in sequence would make the script original.

That said, think about what your scripts are actually doing: one reads file and checks character in it and writes another to it, the other - checks that file and echoes the character. There will be enough scripts that have similar idea, although may use slightly different expression. I think it would be also great if you could rewrite the script somehow to make it one unit, which does all the work, spinning and echoing - that will limit possibilities for substantial similarity in execution.


Notes

To quote Terms of Service:

You agree that all Subscriber Content that You contribute to the Network is perpetually and irrevocably licensed to Stack Exchange under the Creative Commons Attribution Share Alike license. You grant Stack Exchange the perpetual and irrevocable right and license to use, copy, cache, publish, display, distribute, modify, create derivative works and store such Subscriber Content and, except as otherwise set forth herein, to allow others to do so in any medium now known or hereinafter developed (“Content License”) in order to provide the Services, even if such Subscriber Content has been contributed and subsequently removed by You.

There has been effort in 2016 to move towards MIT license but as said on the link, this has been postponed indefinitely.

12
  • Thank you for all your hard work! Automatic MIT License file is an option for github repository. If you don't recommend GPL 3 in github would you pick MIT there? or GPL v2 or different version? My intention was to put full multiple paragraph legal blurb in my github's main multi-page program. Then I'm thinking maybe a short form blurb in the smaller scripts which could point back to the main program. I'm not comfortable pointing (C) to Ask Ubuntu user ID but the github user ID feels OK. Commented Feb 18, 2018 at 13:23
  • @WinEunuuchs2Unix Personally, I have been picking MIT license for all my projects on github. My profile, btw. Simple reason why is MIT is permissive enough for both me the author and users of the software. Take a look at tldr for GPLv3 and for MIT. As for small scripts, most licenses state that you have to include copy of the license into all copies of work, so that means even if it's a small script, it has to have copyright notice. Commented Feb 18, 2018 at 18:59
  • By small script I meant those little children the parent script calls. The parent script would still have full license text. The parent is the most important for functionality / intellectual property rights. The children just do small menial little tasks like read from file, progress bars, systray display updates, etc. To say they have to have a full copyright notice is akin to saying every subroutine or function in the main program has to have a copyright notice. I'm exaggerating of course but I hope you get the gist of my meaning. Commented Feb 18, 2018 at 19:09
  • @WinEunuuchs2Unix short answer, I would say "no". Long answer - see my edit Commented Feb 18, 2018 at 20:18
  • I really like your edit. Well thought out and written. Exactly right how Conky and Cron shouldn't be copyrighted and why a little one liner simply pointing out it is called by a licensed parent makes sense. I didn't think text spinner was all that brilliant since the four characters involved "|, /, -,\" are the only possible ways of doing spinning text. Now Mass Effect Andromeda has a cool Graphical spinner I can see being copyrighted. Same with Windows 10 startup GUI spinner you see overlaid on your grub image background. Then again Microsoft would copyright the air we breathe if they could;) Commented Feb 18, 2018 at 20:28
  • @WinEunuuchs2Unix Well, the thing is there are cases where copyright might be granted, but that doesn't mean it would hold up in court, especially based on originality and substantial similarity. I found when searching that IBM once copyrighted a single instruction (presumably IEFBR14 ). But that doesn't mean court copyrighting one line of text would hold up in court. There's high probability that any other CPU manufacturer could come up with that same instruction in history, just like I could come up with "To be or not to be" line. Commented Feb 18, 2018 at 20:35
  • It would be interesting to test out SE's legal department. I can post the 6 or scripts in question on my new github account with licensing under GPLv2 or MIT or whatever consensus shows is best. Then someone can email SE's legal department pointing out how I'm stealing the code I originally wrote because technically as their website claims it belongs to them. It would be Goliath vs. David and my argument is their legal agreement is buried so deep most people (including myself) have never read it. Then the courts could decide such tom-foolery deserves a big red banner on their website. Commented Feb 18, 2018 at 20:35
  • @WinEunuuchs2Unix No, SE never claims ownership of your code. That wouldn't work Commented Feb 18, 2018 at 20:36
  • 1
    @WinEunuuchs2Unix regarding "those little children the parent script calls." from your comment Consider moving them into functions in your main script. I would assume this would not only make the short form license unnecessary, but also have the side effect of making your script easier to maintain in a single file. Cheers!
    – Elder Geek
    Commented Feb 22, 2018 at 16:04
  • I second Elder Geek's suggestion. ^ Commented Feb 22, 2018 at 16:36
  • @ElderGeek The smaller/child scripts are: 1) Called by cron to get today's sunrise and sunset time from the Internet. 2) Called by systemd upon resume to kill the sleep command by PID so the parent resets the brightness level before display paints. 3) Progress bars (not used in this case) running as IPC (Inter Process Communication) using pipe (FIFO) files. 4) In the future source files (invoked with . command) to initialize environment variables shared by two different parent programs (config and run-time). Hope this helps. Commented Feb 23, 2018 at 0:10
  • @WinEunuuchs2Unix It was just a general alternative suggestion I thought I'd share with you. Cheers!
    – Elder Geek
    Commented Feb 23, 2018 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .