Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ephphatha
Dec 18, 2009




Ithaqua posted:

The "why" is (ideally) part of the commit message in source control. I've smacked devs upside the head (metaphorically speaking) for committing a changeset with a description like "removed the foo". Yes, I can look at a diff of the code and see that you removed the foo. Why did you remove the foo?

Commit messages are great for historical context, but I shouldn't have to look through every commit that touched a file to determine the intended current behaviour of a procedure. That sort of thing should be in a comment in the source and should be updated if poo poo changes. (Of course half the poo poo I work on uses a revision management system that doesn't have any sort of comment functionality).

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

Rocko Bonaparte posted:

I've come to the conclusion that having a good logging framework and logging statements to go with them also helps in explaining what is going on. It still doesn't explain why it's being done the way it is, but it does a marginal job of throwing some human language into the picture. OTOH I'm dealing with people that don't even want to declare classes in Python because that takes more keystrokes, so it's a losing battle.

I really like doing
Python code:
DEBUG("Starting thing here")
try:
    ....
except Foo as e:
    WARN("thing didn't work, recovering: %s" % e)
    ....
DEBUG("Completed thing")
over:
Python code:
# Start doing thing
try:
    ....
except Foo as e:
    # Thing didn't work, try recovering
    ....
# Thing complete
Basically the same amount of typing but far more useful in the long run.

You know, until your disk fills up with debug logs.

tef
May 30, 2004

-> some l-system crap ->

Zombywuf posted:

I really like doing (... log messages instead of comments ...) You know, until your disk fills up with debug logs.

I used a hack in my logging code once

code:
if __debug__:
    def debug(a):
         print a
else:
    def debug(a):
        pass

debug('butts')
If you ran python -O, it would skip the debug messages.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Biowarfare posted:

Sure they do.

r394 -
r393 oqpkczg
r392 asdf
r391 fix
r390 a
r389 a
r388 stuff
...
r2 stuff
r1 initial commit


The alternative being: Copy of index.php2copy of index.php.bak.index.php2.bak (2)
Edit: .old

Let me share with you the recent commits from a new project here:

code:
d360009  cleanup 
1961f8c  Fixing poo poo that magically broke 
074c3a6  meh
2da5dc3  meh
50bb305  refactoring (interface update nullables)
62f86ef  audit
d44f8b1  wip
0000611  misc
This is after I told him to stop writing lovely commit messages. It used to be like this:

Coffee Mugshot
Jun 26, 2010

by Lowtax

Does not compile? Looks like someone needs a testsuite and presumbit hooks. Seriously, I'd rather someone get mad at my tests and linter that keeps being a dick to them about whitespace and lack of backwards compatibility than rollback and blame for every dumb push.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm bound to piss people off by saying this, but writing your own logging library is the horror.

If you all use stuff like the Apache Logging Services, you can change the verbosity and hierarchy of what you want to log on-the-fly. It can also log to various different formats at once:
One big file
Similarly-sized files, shoring off the current one when it reaches the target size
XML based formats
Straight to a SQL database
Over TCP or UDP, to something like their Chainsaw log viewer
And of course, the console with wonderful colored, blinking text, however you format it, because people love The Shiny.

I gave up rewriting logging after I tripped across that.

The Apache Foundation doesn't have one for pure Python, but I use Python integrated with .NET at work, so there I use log4net. At home when I do C++ I use log4cxx. Somebody apparently made something like log4py, but I can't vouch for it. But even if that falls through, a perusal of the PyPi will show plenty of logging libraries.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The problem with logging frameworks is that they always seem like such complete overkill at the beginning of a project when you can do everything you need in ten lines of code... and then a year later you're up to a few thousand lines of code that reinvents badly 90% of a good logging library.

That Turkey Story
Mar 30, 2003

Plorkyeran posted:

The problem with logging frameworks is that they always seem like such complete overkill at the beginning of a project when you can do everything you need in ten lines of code... and then a year later you're up to a few thousand lines of code that reinvents badly 90% of a good logging library.

This is true of just about every library, not just logging libraries.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Plorkyeran posted:

The problem with logging frameworks is that they always seem like such complete overkill at the beginning of a project when you can do everything you need in ten lines of code... and then a year later you're up to a few thousand lines of code that reinvents badly 90% of a good logging library.

Oh, man isn't this the truth.

I still hate using it for some reason, but Python's logging library at least lets you start small and build up as you need more capabilities.

Mr. Tetsuo
Jun 6, 2011

And just once, before I die, I'd like to be Supreme Overlord of Earth. So rebel, my little ones, and conquer the planet!

Bognar posted:

Let me share with you the recent commits from a new project here:

Not bullet proof, and YMMV, but code review goes a long way. Around here, there is no way in hell someone would have his/her diff approved with such half-assed commit messages.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Thermopyle posted:

Oh, man isn't this the truth.

I still hate using it for some reason, but Python's logging library at least lets you start small and build up as you need more capabilities.

Oh that's hilarious. There's miles of Python code at work and they're all making their own logging routines. Take over sys.stdout with your own object that only implements write? Go ahead! Wait, why do we crash when we flush stdout now?

Oh yes, and they loath to make them in classes because that's more typing.

Zombywuf
Mar 29, 2008

Rocko Bonaparte posted:

The Apache Foundation doesn't have one for pure Python, but I use Python integrated with .NET at work, so there I use log4net. At home when I do C++ I use log4cxx. Somebody apparently made something like log4py, but I can't vouch for it. But even if that falls through, a perusal of the PyPi will show plenty of logging libraries.

Or you know, just dump the messages to syslog.


Then cry because all implementations of syslog are awful.

Captain Capacitor
Jan 21, 2008

The code you say?
There are times when I miss Python's "Batteries Included" approach when working with .NET. Some basic logging beyond Debug, a CSV parser that isn't solely in the VB namespace...

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Zombywuf posted:

Or you know, just dump the messages to syslog.


Then cry because all implementations of syslog are awful.

Soon there won't be any more implementations of syslog :v:

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Otto Skorzeny posted:

Soon there won't be any more implementations of syslog :v:

I'm not sure if that's a joke or some newer development in linux.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
systemd replaced syslog with the journal and provided an API compatible wrapper. It's awesome.

Zombywuf
Mar 29, 2008

Suspicious Dish posted:

systemd replaced syslog with the journal and provided an API compatible wrapper. It's awesome.

Is there no end to the heresies that systemd will commit?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Bognar posted:

Let me share with you the recent commits from a new project here:

code:
d360009  cleanup 
1961f8c  Fixing poo poo that magically broke 
074c3a6  meh
2da5dc3  meh
50bb305  refactoring (interface update nullables)
62f86ef  audit
d44f8b1  wip
0000611  misc
This is after I told him to stop writing lovely commit messages. It used to be like this:



If you have a team of literal manchildren who don't know how to write good commit messages, then you institute a policy of commit templates, along with a policy of reverting any commit that doesn't have an appropriate commit message, sight unseen.

ilikelettuce posted:

Not bullet proof, and YMMV, but code review goes a long way. Around here, there is no way in hell someone would have his/her diff approved with such half-assed commit messages.

Or this. You should be doing code reviews anyway.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Zombywuf posted:

Is there no end to the heresies that systemd will commit?

I'm sorry that I actually like tagged logs where service names and PIDs are all available.

Dren
Jan 5, 2001

Pillbug
I might actually get off my rear end and attempt to write a small app in my spare time. If I'm looking at forking a git project with no licensing info that itself is a fork of a fork (none of which have any licensing info) what should I do when it comes to licensing?

Should I contact everyone up and down the line and see if they're ok with some license I put on a project? Should I completely start over instead (I'd likely do a heavy rewrite anyway)?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Dren posted:

I might actually get off my rear end and attempt to write a small app in my spare time. If I'm looking at forking a git project with no licensing info that itself is a fork of a fork (none of which have any licensing info) what should I do when it comes to licensing?

Should I contact everyone up and down the line and see if they're ok with some license I put on a project? Should I completely start over instead (I'd likely do a heavy rewrite anyway)?

If you're honestly worried about it, you probably can't use the code. Open an issue and move along.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Volmarias posted:

If you have a team of literal manchildren who don't know how to write good commit messages, then you institute a policy of commit templates, along with a policy of reverting any commit that doesn't have an appropriate commit message, sight unseen.

Or this. You should be doing code reviews anyway.

Are you saying he should wip them into shape?

Dren
Jan 5, 2001

Pillbug

pokeyman posted:

If you're honestly worried about it, you probably can't use the code. Open an issue and move along.

I just don't want to make something halfway decent, slap an open source license on it, and have someone complain that it's theirs by copyright since they never specified anything at all.

If my thing ends up sucking or not existing it's no big deal but it would suck to put a bunch of effort in and have someone give me poo poo because they never were bothered to include licensing info.

JawnV6
Jul 4, 2004

So hot ...
So don't do that.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Volmarias posted:

Or this. You should be doing code reviews anyway.

I've been pushing for code reviews, and we're slowly starting to do them. However, the plan is to introduce them for the more junior developers first and then move up the chain. The guy who writes 'wip' and 'asdf' is our second most senior developer, so it will be a bit before that is fixed by code reviews.

Zombywuf
Mar 29, 2008

Suspicious Dish posted:

I'm sorry that I actually like tagged logs where service names and PIDs are all available.

I hate needing dbus in order to boot.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Zombywuf posted:

I hate needing dbus in order to boot.

Well good thing, because systemd has none of that.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Rocko Bonaparte posted:

Are you saying he should wip them into shape?

Nice!

Zombywuf
Mar 29, 2008

Suspicious Dish posted:

Well good thing, because systemd has none of that.

https://wiki.archlinux.org/index.php/D-Bus

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

DBus refers to both a serialization protocol and a system daemon. systemd uses the serialization protocol internally with UNIX sockets (point-to-point DBus), so it requires the client library. The system daemon part is not needed for early boot.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Suspicious Dish posted:

systemd uses the serialization protocol internally with UNIX sockets (point-to-point DBus), so it requires the client library.

They're also working on removing the dbus library dependency by implementing their own, which while it's another n+1 problem, it makes my life easier, since currently systemd and dbus are mutually build dependent.

Dbus needs systemd to be built so it knows where to install the dbus service's unit files. Systemd needs dbus' libraries and headers.

Well, that's what it used to need. Now dbus actually needs some of systemd's libraries, so you can't even fake the pkg-config to build dbus independently any more.

Zombywuf
Mar 29, 2008

Fucks sake, get your filthy dbus loving hands off my init.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Dren posted:

have someone complain that it's theirs by copyright since they never specified anything at all.

It is. Just because someone posted it on github doesn't mean it's free for you take and license how you want.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Zombywuf posted:

Fucks sake, get your filthy dbus loving hands off my init.

The daemon is nowhere near your init. But what do you have against dbus?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Edison was a dick posted:

They're also working on removing the dbus library dependency by implementing their own, which while it's another n+1 problem, it makes my life easier, since currently systemd and dbus are mutually build dependent.

Dbus needs systemd to be built so it knows where to install the dbus service's unit files. Systemd needs dbus' libraries and headers.

Well, that's what it used to need. Now dbus actually needs some of systemd's libraries, so you can't even fake the pkg-config to build dbus independently any more.

Yeah, it's a bit ugly at the moment. What you have to do is build DBus without systemd integration to bootstrap systemd, then build systemd, then build DBus again. This is a very typical problem in OS integration, though, and it's one that's existed since the first distros have ever existed.

The systemd people are writing kdbus, but it's going to take some time. They hope to have it deployed by early next year.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Dren posted:

I just don't want to make something halfway decent, slap an open source license on it, and have someone complain that it's theirs by copyright since they never specified anything at all.

The GitHub terms of service allow you to fork the repository, even if it has no license attached, but that's about it. Like I said, if you're worried about it then stay away.

Dren
Jan 5, 2001

Pillbug

pokeyman posted:

The GitHub terms of service allow you to fork the repository, even if it has no license attached, but that's about it. Like I said, if you're worried about it then stay away.

Thanks, I'll roll my own. I feel like it's kind of a strange culture on github to not require a license to be specified but to explicitly permit forking. It seems like forking something with no license leaves you in kind of a no-man's land. You were allowed to fork but you're not really allowed to use the code for anything because it's implicitly copyrighted.

I found this article on the topic, unfortunately it wasn't very helpful except to note the problem I have. http://www.zdnet.com/github-improves-open-source-licensing-polices-7000018213/

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Dren posted:

Thanks, I'll roll my own. I feel like it's kind of a strange culture on github to not require a license to be specified but to explicitly permit forking. It seems like forking something with no license leaves you in kind of a no-man's land. You were allowed to fork but you're not really allowed to use the code for anything because it's implicitly copyrighted.

Forking is the entire point of GitHub, so it makes sense for it to be explicitly permitted. I share your pain though, it sucks to come across code with an uncertain or nonexistent license. Open an issue, hope the maintainer updates it, and in the meantime do your best!

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Spotted at work today in C code for an embedded device:

code:
#define MAX_U32 (2^32 - 1) // the largest possible 32 bit unsigned value

Adbot
ADBOT LOVES YOU

RoadCrewWorker
Nov 19, 2007

camels aren't so great
Aw, i actually preferred the "32^2" version. I don't doubt that's out there at least a couple of times.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply