Tiny Core Linux

Tiny Core Extensions => TCE Bugs => Topic started by: aw on September 16, 2015, 10:21:11 AM

Title: openssh extension start script mixup
Post by: aw on September 16, 2015, 10:21:11 AM
Hi,

I noticed a small error in the openssh.ini file of the x86/openssh extension - http://repo.tinycorelinux.net/6.x/x86/tcz/src/openssh/openssh.ini

The following lines:

Quote
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config

.. should look like

Quote
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
Title: Re: openssh extension start script mixup
Post by: bmarkus on September 16, 2015, 10:24:09 AM
Would be better to publish a diff file instead of asking readers to compare old and new script to find what is changed

:(
Title: Re: openssh extension start script mixup
Post by: hiro on September 16, 2015, 10:47:02 AM
both lines changed, diff wouldn't have added any easier to see information.
Title: Re: openssh extension start script mixup
Post by: hiro on September 16, 2015, 10:49:12 AM
it's not an .ini file though, but /usr/local/etc/init.d/openssh

^ i take that back, i didn't see those source files before.
Title: Re: openssh extension start script mixup
Post by: aw on September 16, 2015, 10:50:36 AM
Sure!

Code: [Select]
--- openssh.ini.old 2015-09-16 14:46:22.000000000 +0000
+++ openssh.ini 2015-09-16 14:46:33.000000000 +0000
@@ -4,8 +4,8 @@
 
 start(){
    [ -f /usr/local/etc/ssh ] || mkdir -p /usr/local/etc/ssh
-   [ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
-   [ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
+   [ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
+   [ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
    [ -f /usr/local/etc/ssh/ssh_host_rsa_key ] || ssh-keygen -t rsa -N "" -f /usr/local/etc/ssh/ssh_host_rsa_key
    [ -f /usr/local/etc/ssh/ssh_host_dsa_key ] || ssh-keygen -t dsa -N "" -f /usr/local/etc/ssh/ssh_host_dsa_key
    [ -f /usr/local/etc/ssh/ssh_host_ecdsa_key ] || ssh-keygen -t ecdsa -N "" -f /usr/local/etc/ssh/ssh_host_ecdsa_key

Apply with
Code: [Select]
patch < openssh.patch
Title: Re: openssh extension start script mixup
Post by: bmarkus on September 16, 2015, 11:05:37 AM
Well, I mean pointing to the difference and explaining the change not the diff command itself, not to push readers to find it himself. It is not the way to convince people about changes.
Title: Re: openssh extension start script mixup
Post by: Rich on September 16, 2015, 11:18:25 AM
Hi bmarkus
Quote
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
It's testing for the wrong file to determine whether the copy operation should take place. The names in the test are
reversed.
Title: Re: openssh extension start script mixup
Post by: hiro on September 16, 2015, 11:19:48 AM
you said "diff file"
anyways, the change fixes that sshd config gets overwritten by ssh config if ssh config doesn't exist but sshd does, vice-versa.
Title: Re: openssh extension start script mixup
Post by: Rich on September 16, 2015, 11:23:56 AM
Hi hiro
Quote
you said "diff file"
Regardless, two short sentences as I posted would have gone a long way to make it clear why the OP felt this change
was necessary.
Title: Re: openssh extension start script mixup
Post by: aw on September 16, 2015, 11:30:35 AM
Thanks, noted for future reference.
Title: Re: openssh extension start script mixup
Post by: hiro on September 16, 2015, 11:56:53 AM
anyways, good catch, aw.