Warning dependency cycle detected when installing lolcat

Hi all, first post, just moved over to EndeavourOS from Arco, very impressed so far. With both distros actually. :+1:

Never had this happen before…

~ 
 pacman -S lolcat
[sudo] password for redacted: 
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: rubygems will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-abbrev will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-base64 will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-benchmark will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-bigdecimal will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-bundler will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-cgi will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-csv will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-date will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-delegate will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-did_you_mean will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-digest will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-drb will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-ruby2_keywords will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-english will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-erb will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-etc will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-fcntl will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-fiddle will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-fileutils will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-find will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-forwardable will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-getoptlong will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-io-console will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-io-nonblock will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-io-wait will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-ipaddr will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-irb will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-reline will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-json will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-logger will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-mutex_m will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-net-http will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-uri will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-open-uri will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-stringio will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-time will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-psych will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-racc will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-rdoc will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-tmpdir will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-minitest will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-power_assert will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-rake will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-rexml will be installed before its ruby dependency
warning: dependency cycle detected:
warning: ruby-test-unit will be installed before its ruby dependency

Package (62)                       New Version  Net Change  Download Size

community/ruby                     3.0.5-1       11.39 MiB       2.77 MiB
community/ruby-abbrev              0.1.0-4        0.01 MiB       0.01 MiB
community/ruby-base64              0.1.1-4        0.01 MiB       0.01 MiB
community/ruby-benchmark           0.2.0-4        0.05 MiB       0.02 MiB
community/ruby-bigdecimal          3.1.2-4        0.21 MiB       0.08 MiB
community/ruby-bundledgems         3.0.5-1        0.00 MiB       0.00 MiB
community/ruby-bundler             2.4.1-1        1.48 MiB       0.38 MiB
community/ruby-cgi                 0.3.6-1        0.24 MiB       0.06 MiB
community/ruby-csv                 3.2.5-4        0.53 MiB       0.10 MiB
community/ruby-date                3.2.2-4        0.35 MiB       0.11 MiB
community/ruby-delegate            0.2.0-4        0.03 MiB       0.01 MiB
community/ruby-did_you_mean        1.6.1-4        0.10 MiB       0.03 MiB
community/ruby-diff-lcs            1.5.0-1        0.32 MiB       0.08 MiB
community/ruby-digest              3.1.1-1        0.15 MiB       0.04 MiB
community/ruby-drb                 2.1.0-5        0.20 MiB       0.05 MiB
community/ruby-english             0.7.1-5        0.01 MiB       0.01 MiB
community/ruby-erb                 4.0.2-2        0.08 MiB       0.03 MiB
community/ruby-etc                 1.3.0-6        0.06 MiB       0.02 MiB
community/ruby-fcntl               1.0.1-4        0.02 MiB       0.01 MiB
community/ruby-fiddle              1.1.0-4        0.20 MiB       0.06 MiB
community/ruby-fileutils           1.6.0-4        0.12 MiB       0.03 MiB
community/ruby-find                0.1.1-4        0.01 MiB       0.01 MiB
community/ruby-forwardable         1.3.2-6        0.03 MiB       0.01 MiB
community/ruby-getoptlong          0.1.1-3        0.03 MiB       0.01 MiB
community/ruby-io-console          0.5.11-3       0.05 MiB       0.02 MiB
community/ruby-io-nonblock         0.1.0-3        0.02 MiB       0.01 MiB
community/ruby-io-wait             0.2.3-4        0.02 MiB       0.01 MiB
community/ruby-ipaddr              1.2.4-3        0.05 MiB       0.02 MiB
community/ruby-irb                 1.4.2-1        0.41 MiB       0.11 MiB
community/ruby-json                2.6.3-1        0.33 MiB       0.09 MiB
community/ruby-logger              1.5.1-3        0.07 MiB       0.02 MiB
community/ruby-manpages            0.6.1-4        0.05 MiB       0.02 MiB
community/ruby-minitest            5.16.3-1       0.69 MiB       0.12 MiB
community/ruby-mutex_m             0.1.1-3        0.01 MiB       0.01 MiB
community/ruby-net-http            0.2.2-2        0.29 MiB       0.08 MiB
community/ruby-open-uri            0.2.0-3        0.05 MiB       0.02 MiB
community/ruby-optimist            3.0.1-2        0.11 MiB       0.03 MiB
community/ruby-paint               2.3.0-1        0.07 MiB       0.02 MiB
community/ruby-power_assert        2.0.2-1        0.09 MiB       0.03 MiB
community/ruby-psych               4.0.6-1        0.30 MiB       0.08 MiB
community/ruby-racc                1.6.0-3        0.35 MiB       0.10 MiB
community/ruby-rainbow             3.1.1-1        0.08 MiB       0.03 MiB
community/ruby-rake                13.0.6-1       0.26 MiB       0.07 MiB
community/ruby-rdoc                6.4.0-4        2.86 MiB       0.67 MiB
community/ruby-reline              0.3.1-2        0.41 MiB       0.10 MiB
community/ruby-rexml               3.2.5-1        0.39 MiB       0.08 MiB
community/ruby-rspec               3.12.0-1       0.01 MiB       0.01 MiB
community/ruby-rspec-core          3.12.0-1       1.27 MiB       0.32 MiB
community/ruby-rspec-expectations  3.12.0-1       0.77 MiB       0.19 MiB
community/ruby-rspec-mocks         3.12.0-1       0.71 MiB       0.18 MiB
community/ruby-rspec-support       3.12.0-1       0.25 MiB       0.08 MiB
community/ruby-ruby2_keywords      0.0.5-1        0.01 MiB       0.01 MiB
community/ruby-stdlib              3.0.5-1        0.00 MiB       0.00 MiB
community/ruby-stringio            3.0.2-4        0.07 MiB       0.03 MiB
community/ruby-term-ansicolor      1.7.1-2        0.12 MiB       0.04 MiB
community/ruby-test-unit           3.5.7-1        0.89 MiB       0.20 MiB
community/ruby-time                0.2.0-4        0.04 MiB       0.01 MiB
community/ruby-tins                1.31.1-1       0.47 MiB       0.10 MiB
community/ruby-tmpdir              0.1.2-3        0.01 MiB       0.01 MiB
community/ruby-uri                 0.11.0-5       0.23 MiB       0.06 MiB
community/rubygems                 3.3.25-1       2.15 MiB       0.55 MiB
community/lolcat                   100.0.1-1      0.13 MiB       0.12 MiB

Total Download Size:    7.59 MiB
Total Installed Size:  29.75 MiB

:: Proceed with installation? [Y/n] 

Is this something I need to worry about or?

Thanks in advance for any help!

Probably not. Those are just warnings, and ruby will be installed anyway.

1 Like

The question is… do you want so many dependencies installed just to have lolcat? :rofl:

4 Likes

Reddit has definite YES for that question :joy:

3 Likes

Why do people even use ruby? It’s such a soy language…

I should rewrite lolcat in C, it would have no dependencies. It would be maybe 30 lines of code. The tricky part is to actually read ruby code to faithfully pick colours, because I can just eyeball it and it wouldn’t be the same.

1 Like

That’s a great way to become popular!
:frog: :rainbow:

2 Likes

Be right back, I just need a refreshing drink of atrazine. :rofl:

DISCLAIMER: This is a joke, do not drink atrazine, it’s toxic.

1 Like

Haha, as long as my system isn’t going to go by by next reboot after I made it all pretty and didn’t make a gitlab yet for my files, I’m happy.

From what I can gather it’s to do with multilib toolchain updates, according to this: https://bbs.archlinux.org/viewtopic.php?pid=979331#p979331

And I was going to change the pacman -S lolcat to ruby to hide my shame but as someone pointed out above, it’s also “soy”

Just for fun, I made a very simple (i.e. bloat-free) implementation in C. No dependencies, except the C standard library. Here it is printing its own source code:

I don’t feel like implementing all the fancy features (bloat) that lolcat has, I leave that as an exercise to the reader. It’s very rudimentary, doesn’t even concatenate files, doesn’t handle unicode, doesn’t handle ANSI codes, etc… but at least it doesn’t have 50 ruby dependencies… :rofl:

Here is the source code as text

This is obsolete now, look below for updated versions.

// compile with: gcc atrazine.c -o atrazine -lm -O2

#include <math.h>
#include <stdio.h>

#define CSI "\033["

void rainbow(float phase) {
  printf("%s38;2;%d;%d;%dm", CSI,
        /* red   */ (int) (sinf(phase + 0       ) * 127 + 128),
        /* green */ (int) (sinf(phase + 2*M_PI/3) * 127 + 128),
        /* blue  */ (int) (sinf(phase + 4*M_PI/3) * 127 + 128));
}

int main() {
  int nl_offset = 3;
  float omega = 0.1f;
  int t = 0;
  int line = 0;

  char c;

  rainbow(omega*t);

  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      t = 0;
      line++;
      printf("%sm\n", CSI);
    } else {
      printf("%c", c);
    }
    rainbow(omega*((++t) + nl_offset * line));
  }
  printf("%sm\n", CSI);
}
4 Likes

Gee - and that’s why I dropped the ‘real’ one a few years ago… I think THIS version might have what it takes… IF I can remember how to compile it! :grin:

Also - no man files or even a Usage: entry! I'll have think...

Here is a slightly improved version that works with UTF-8 and (somewhat poorly) detects ANSI escape sequences. It’s still very rough.

Source

THIS IS OUTDATED. LOOK BELOW FOR A NEWER VERSION.

// compile with: gcc atrazine.c -o atrazine -lm -O2 -Wpedantic -Wall -Wextra

#include <math.h>
#include <stdio.h>
#include <ctype.h>

#define CSI "\033["
#define RESET CSI"m"

void rainbow(float phase) {
  printf("%s38;2;%d;%d;%dm", CSI,
    /* red   */ (int) (sinf(phase + 0       ) * 127 + 128),
    /* green */ (int) (sinf(phase + 2*M_PI/3) * 127 + 128),
    /* blue  */ (int) (sinf(phase + 4*M_PI/3) * 127 + 128)
  );
}

inline int is_UTF8_continuation(char c) {
  return (c & 0xc0) == 0x80;
}

/* state machine that detects ANSI escape sequences, somewhat poorly */
int in_ANSI(char c) {
  static int state = 0;
  if (state && (isalpha(c) || c == '~' || c == '\033'))  state = 0;
  if (c == '\033' && !state)                             state = 1;
  return state;
}

int main() {
  float omega = 0.1f;
  int nl_offset = 3, t = 0, line = 0;
  char c;

  rainbow(omega * t);

  while ((c = getchar()) != EOF) {
    char peek = getchar();
    ungetc(peek, stdin);

    if (c == '\n') {
      t = 0;
      line++;
      printf(RESET);
    }

    printf("%c", c);

    if (!is_UTF8_continuation(peek) && !in_ANSI(c)) {
      rainbow(omega * ((++t) + nl_offset * line));
    }
  }

  printf(RESET);
}

The first line tells you how to compile it :slight_smile:

Now you can pipe neofetch output into it and it won’t make a mess:

2 Likes

It’s not the ‘C’ code that impresses so much as knowledge of HOW to use it! Thanks - I will see if I’ve got it… YUP!

Can’t say as the colours enhance readability on itself :grin: but it definitely works very well!!

How to use what? My rudimentary version of lolcat? Just provide it stdin and it will print to stdout. Not much else to it. It’s not even a cat program, it doesn’t concatenate anything.

1 Like

Yeah - I DID actually remember (re-deduce) that, as you see from my description of a test run above. My ‘C’ may have rust on it, but I’m not aware of any new holes (yet)… :grin:

1 Like

So do I have rust on C. I think long time ago C did not have inline functions nor C++ comments… apparently they are in the current C standard?

In addition, if int main() didn’t return an integer, compiler did warn about it with such warning flags…

@keybreak was kind enough to do some tests comparing atrazine to lolcat. On his machine atrazine is about 63 times faster than lolcat.

I find it unsurprising, since Ruby is a rather crappy, interpreted language.

1 Like

The (admittedly very cool) coding above made me wonder if anyone else had similar ideas and I found this:

Cat made out of py. Yummy.

1 Like

This python one sucks, it does fail on ANSI codes, unlike both atrazine and lolcat

image

And…atrazine runs 42 times faster :laughing:

:frog: :rainbow:

1 Like

Yeah not all code is written equal it would seem, regardless of the language used :grin:

Rusty ol cat

^ This one is cool.

2 Likes

That’s much better!

But atrazine is still 19,4 times faster!

:frog: :rainbow:

Although it’s rust, it’s still written poorly, i even wonder why…
@Kresimir knows his stuff! :frog:

1 Like