Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation of No-Ip.com fails #3320

Closed
ben0rism opened this issue Jan 6, 2020 · 13 comments
Closed

Installation of No-Ip.com fails #3320

ben0rism opened this issue Jan 6, 2020 · 13 comments
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Milestone

Comments

@ben0rism
Copy link

ben0rism commented Jan 6, 2020

Details:

  • Date | Mon 6 Jan 18:19:27 GMT 2020
  • Bug report | N/A
  • DietPi version | v6.28.0 (MichaIng/master)
  • Image creator | DietPi Core Team
  • Pre-image | Raspbian Lite
  • SBC device | RPi 2 Model B (armv7l) (ID=2)
  • Kernel version | Linux DietPi 4.19.75-v7+ DietPi-System | Quirks noticed by v158 image update  #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
  • Distro | buster (ID=5)
  • Command | unzip -o 67.zip
  • Exit code | 11
  • Software title | DietPi-Software

Steps to reproduce:

  1. Installation DietPi
  2. DHCP ON - ( connected via eth)

Expected behaviour:

Installation No-Ip.com dac

Actual behaviour:

Extra details:

Nothing special

Additional logs:

Archive:  67.zip
caution: filename not matched:  
@MichaIng
Copy link
Owner

MichaIng commented Jan 8, 2020

@ben0rism
Many thanks for your report. I'll try to replicate.

@MichaIng MichaIng added this to the v6.29 milestone Jan 9, 2020
@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

Dammit, this bug has been introduced with this fix: #3300
That fixed extraction of zip archives to a target dir, but when an empty argument is given, unzip interprets this as contained file name and of course does not find an empty string file name... Not smart at all.

Hence it is not possible to to pass a variable to the unzip command to conditionally add an argument. I tested all variations:

2020-01-09 13:03:32 root@VM-Buster:/tmp/DietPi-Software$ unzip -o 67.zip ''
Archive:  67.zip
caution: filename not matched:
2020-01-09 13:03:43 root@VM-Buster:/tmp/DietPi-Software$ unzip '' -o 67.zip
unzip:  cannot find or open , .zip or .ZIP.
2020-01-09 13:03:47 root@VM-Buster:/tmp/DietPi-Software$ unzip -o '' 67.zip
unzip:  cannot find or open , .zip or .ZIP.

Unique issue to unzip, at least, all other archivers ignore empty arguments intuitive:

2020-01-09 13:08:49 root@VM-Buster:/tmp$ G_RUN_CMD 7zr '' -y x gmediarender_x86_64.7z
[  OK  ] 7zr  -y x gmediarender_x86_64.7z
2020-01-09 13:09:04 root@VM-Buster:/tmp$ G_RUN_CMD 7zr -y '' x gmediarender_x86_64.7z
[  OK  ] 7zr -y  x gmediarender_x86_64.7z
2020-01-09 13:09:09 root@VM-Buster:/tmp$ G_RUN_CMD 7zr -y x '' gmediarender_x86_64.7z
[  OK  ] 7zr -y x  gmediarender_x86_64.7z
2020-01-09 13:09:13 root@VM-Buster:/tmp$ G_RUN_CMD 7zr -y x gmediarender_x86_64.7z ''
[  OK  ] 7zr -y x gmediarender_x86_64.7z
2020-01-09 13:10:53 root@VM-Buster:/tmp$ tar '' -xf libSDL2_armv7l.tar.bz2
2020-01-09 13:17:33 root@VM-Buster:/tmp$ tar -xf libSDL2_armv7l.tar.bz2 ''

So we need to wrap the whole thing into if-then-else.

@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

Affected software titles:

  • No-IP: All archs/models
  • WebIOPi: BPi Pro only
  • WiFi Hotspot: RTL8188C on non-Armbian based ARMs
  • EmonHub
  • Gogs ARMv6/7
  • Ampache

One liner hotfix via MOTD hack required.

@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

Ah perfect, there is a way:

2020-01-09 13:50:25 root@VM-Buster:/tmp$ var='dir with spaces'
2020-01-09 13:50:53 root@VM-Buster:/tmp$ unzip -o test.zip ${var:+"$var"}
Archive:  test.zip
caution: filename not matched:  dir with spaces
2020-01-09 13:50:56 root@VM-Buster:/tmp$ var='-ddir with spaces'
2020-01-09 13:51:13 root@VM-Buster:/tmp$ unzip -o test.zip ${var:+"$var"}
Archive:  test.zip
  inflating: dir with spaces/index.php
  inflating: dir with spaces/readme.txt
2020-01-09 13:51:15 root@VM-Buster:/tmp$ unset var
2020-01-09 13:51:27 root@VM-Buster:/tmp$ unzip -o test.zip ${var:+"$var"}
Archive:  test.zip
  inflating: index.php
  inflating: readme.txt
2020-01-09 13:51:29 root@VM-Buster:/tmp$ l
drwxr-xr-x 2 root root   80 Jan  9 13:51 'dir with spaces'
-rw-r--r-- 1 root root 106K Dec 28  2016  index.php
-rw-r--r-- 1 root root  70K Dec 28  2016  readme.txt
-rw-r--r-- 1 root root  38K Dec 29  2016  test.zip

Just found the slight syntax difference:

  • ${var:+alternative} if variable is not empty, place alternative
  • ${var+alternative} if variable is not defined, place alternative, which means even var='' leads to alternative being placed, which means that unset would be required.

@Joulinar
Copy link
Collaborator

Joulinar commented Jan 9, 2020

@MichaIng
stupid question from my side. For the MOTD hack. Does MOTD needs to be activated or will it work even if MOTD is not enabled within dietpi-banner

MichaIng added a commit that referenced this issue Jan 9, 2020
+ DietPi-Software | Fix zip extraction without defined target dir. The new syntax ${var:+alt} allows as well cleaner argument handling for other extractors: #3320
@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

@Joulinar
It needs to be activated. Actually I want to implement this separately as "live patches" or something, so less sneaky and more transparent. Users can then enable or disable it or check which patches would be done and decide themselves.

This is not only useful where I made a mistake or too few testing, and bugs slipped through beta, but as well when external changes happen, e.g. download URLs change, repo keys break/expire, new software versions break our installer/config files and all such. For this to keep up with, a very regular release schedule of 1 per month would be required, but the last releases showed that I am not able to implement all I want in one month, including beta phase etc. and by times new issues arise faster then I am able to fix. Hence such hotfixes would be able to prevent users from running into simple-to-fix (one-liner) bugs quickly while we are able to take the time a new release and wanted features/changes + testing take.

@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

Fixed with (allowed some code simplification as well, this time tested up and down 😉): 9b3df75
Changelog: ebc7b20

Quick fix:

sed -i 's/G_RUN_CMD unzip -o $file "$target"/G_RUN_CMD unzip -o $file ${target:+"$target"}/' /DietPi/dietpi/dietpi-software

@MichaIng MichaIng added the Solution available 🥂 Definite solution has been done label Jan 9, 2020
@Joulinar
Copy link
Collaborator

Joulinar commented Jan 9, 2020

@MichaIng

Actually I want to implement this separately as "live patches"

sounds great, like that idea. I hope it will not cause to much overhead to keep the track between the releases and the applied HotFix

This is not only useful where I made a mistake or too few testing

We are all humans and these thinks could happen. And you are doing such a great job. 👍
Unfortunately I don't understand that much from this shell coding stuff. It would make things easier to assist you. (not just spamming around on the board)

@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

Live patch, for now:

# Live patches
# - https://github.com/MichaIng/DietPi/issues/3313
[[ $G_DIETPI_VERSION_SUB == 2[78] && -w '/DietPi/dietpi/func/dietpi-banner' ]] && sed -i '/G_TERM_CLEAR$/s/$/ 2> \/dev\/null || printf "\\ec"/' /DietPi/dietpi/func/dietpi-banner
# - https://github.com/MichaIng/DietPi/issues/3314
[[ $G_DIETPI_VERSION_SUB == 2[78] && $G_DISTRO == 4 && -w '/DietPi/dietpi/dietpi-software' ]] && sed -i '/always-show-logo/d' /DietPi/dietpi/dietpi-software
# - https://github.com/MichaIng/DietPi/issues/3320
[[ $G_DIETPI_VERSION_SUB == 2[78] && -w '/DietPi/dietpi/dietpi-software' ]] && sed -i 's/G_RUN_CMD unzip -o $file "$target"/G_RUN_CMD unzip -o $file ${target:+"$target"}/' /DietPi/dietpi/dietpi-software

# MOTD
motd='★☆ ✿¸.•*¨★*☆*★`*•..¸✿ ☆¯`★
          ★[̲̅̅H̲̅][̲̅̅A̲̅][̲̅̅P̲̅][̲̅̅P̲̅][̲̅̅Y̲̅]★[̲̅̅N̲̅][̲̅̅E̲̅][̲̅̅W̲̅]★[̲̅̅Y̲̅][̲̅̅E̲̅][̲̅̅A̲̅][̲̅̅R̲̅]★
          *”˜˜”*°•.♥ღϠ₡ღ♥♥ღϠ₡ღ♥♥ღϠ₡ღ*”˜”*'
 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Installing No-IP: Dynamic DNS update client

[  OK  ] DietPi-Software | Connection test: https://dietpi.com/downloads/binaries/all/noip_x32_x64.zip
[  OK  ] DietPi-Software | wget https://dietpi.com/downloads/binaries/all/noip_x32_x64.zip -O 67.zip
[  OK  ] DietPi-Software | unzip -o 67.zip
[  OK  ] DietPi-Software | rm 67.zip
...
[  OK  ] DietPi-Services | restart : noip2

@MichaIng
Copy link
Owner

MichaIng commented Jan 9, 2020

@Joulinar

Unfortunately I don't understand that much from this shell coding stuff. It would make things easier to assist you. (not just spamming around on the board)

I am very thankful for your support on issues/reports on forum and here. You debug steps are great and having a lower issue reply time is great anyway ❤️.

I was thinking to add you as contributor here and moderator in the forum, so you're able to edit/flag/move threads/issues. This enables you push commits as well, however sticking with PRs for now make sense. What do you think?

@Joulinar
Copy link
Collaborator

Joulinar commented Jan 9, 2020

@MichaIng
I can confirm the fix working

however sticking with PRs for now make sense.

what do you mean with PRs 🙈

@MichaIng
Copy link
Owner

@Joulinar
Pull requests 😉.

@ben0rism
Copy link
Author

Cool that was fast! Thank you guys! :) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

3 participants