• 0 Posts
  • 42 Comments
Joined 3 years ago
cake
Cake day: July 1st, 2023

help-circle


  • This breaks down when there are more than one SOURCE file, since each DESTINATION file depends on all source files. This means that $< will always be the first file in SOURCE. For example, if source contains the files 0001-01-01-some-file-name.md and 0002-02-02-some-file-name.md:

    $ make -n
    mkdir -p destination/0001/01/01/  
    /bin/bash ./myscript.sh source/0001-01-01-some-file-name.md > destination/0001/01/01/some-file-name.md  
    mkdir -p destination/0002/02/02/  
    /bin/bash ./myscript.sh source/0001-01-01-some-file-name.md > destination/0002/02/02/some-file-name.md  
    

    OP is probably better off using a scripting language to automate this kind of thing

    EDIT: Fixed example filenames









  • In practice, that would require buy-in from the apartment/house association board, since the average resident would be unlikely to care about whether or not the software was open source or owned by the association. Cost would likely be a more important metric for most members, and here a company that serviced multiple associations would likely have an edge, especially since they could also provide general support to the end-users.

    If it did get approved by the associations members, then the board would then likely have to hire a third party do carry out the actual development. If you’re (very!) lucky, then one or more members might be willing to do it cheaper than a third party, but that would likely only last for however long they lived in one of the apartments or houses.

    I would put this scenario down as possible in theory, but very unlikely to work out in practice. The vast majority of such associations would go with an existing (closed-source) SAS provider, since that would be a lot less work and since it would survive the constant turnover in such an association.

    I honestly have an even harder time seeing how it would work out for OSS in general, since most software does not come with an existing organization, nor a community that is as directly invested as residents in an associations. For most projects, the work involved in setting up and managing such an association would greatly exceed the work involved in developing the software itself, which, similarly to the above, most of the users would not be able to contribute to

    EDIT: A more plausible scenario for an house/apartment association, would be somebody setting up a company structured as a co-op and then recruiting multiple associations as co-owners/customers. Is that what you had in mind? Though that of course requires that somebody has both the funds and the interest to get it off the ground, which is unlikely to be an existing association



  • Here are a few random thoughts based on skimming the source:

    • I’d advice againsts using -Weverything. Many of the warnings it enables are not very useful, and you are going to get a lot of them. And if you enable warnings, then fix them, or you’ll just miss it when your changes cause new warnings.
    • A couple of your check functions may reach the end of the function without returning, if type is not on of the expected values. That is undefined behavior. One simple way to avoid this, is to move the common return out of the ifs.
    • That const std::string type argument in the above functions should be enums, since you are just checking againts one of three fixed values ("name", "ext", and "date").
    • Speaking of which, I can’t think of any situation where you’d want to have an const std::string argument. Either use a const reference (const std::string&) or a string_view (const std::string_view). The latter has the advantage that it doesn’t create a new std::string if you call the function with a C-string and it can be sliced cheaply.
    • You have const std::string &df = df_str; in a couple of places, where df_str is a std::string passed by value. That is of course utterly pointless, and you should simply change df_str to be passed by const reference or as a string view.
    • You define main with an int return type, but use std::exit to exit the function. Those std::exit calls could all be replaced with return, which does the same thing in main.
    • Don’t do work before you need the results. For example, in check_type you perform two checks (saved as starts_with_dot and has_dash), that are not used if name == "name".
    • Nobody who sees a function named check_exists would expect it to create a directory, so it should be renamed to something more descriptive. It is also redundant, since you already check that the directory exists in main.cpp via is_directory, but unlike that check check_exists doesn’t actually verify that the path is a directory.
    • is_founded is Engrish

  • ls can be piped safely if you use --zero:

    ls --zero *.txt | xargs --null -I {} mv {} /home/user/Documents
    

    While the above is a pretty silly example, one reason why you might want to do this is that xargs has a -P/--max-procs argument, that runs N commands in parallel. So you could do something like the following to gzip four files in parallel:

    ls --zero *.txt | xargs --null -n1 -P4 gzip
    

    This is a bit simpler than using the equivalent

    find . -maxdepth 1 -name '*.txt' -print0 | xargs --null -n1 -P4 gzip
    




  • Neither of those terms seem problematic to me; a plain reading would be “mostly” means more than half of the code, and “tolerated” would mean that the ban is not enforced on such projects. Of course, if you are already operating under the assumption that Codeberg is acting in bad faith, then it doesn’t matter what the terms of service says nor how they they might say that they interpret them.

    It is, however, not surprising that their terms of service are subject to interpretation. That was already the case before they added these particular terms. For example, the Codeberg TOS already included a prohibition against “content that harms the reputation of Codeberg” before the recent changes. Codeberg simply added projects related to cryptocurrency as an example, when the ban was voted through. It is furthermore the case that most, if not all, terms of service are subject to interpretation. We are talking about documents describing human behavior, not machine code.

    If this kind of thing is not acceptable to you, then your only real solution is to self-host