All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable
@ 2016-09-08 14:33 Floris Bos
  2016-09-08 14:33 ` [Buildroot] [PATCH 2/2] package/php: Set MySQL socket path Floris Bos
  2016-09-08 14:44 ` [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Yann E. MORIN
  0 siblings, 2 replies; 6+ messages in thread
From: Floris Bos @ 2016-09-08 14:33 UTC (permalink / raw)
  To: buildroot

Add MYSQL_SOCKET variable with default socket location for other
packages to use.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
 package/mysql/mysql.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/mysql/mysql.mk b/package/mysql/mysql.mk
index 534bd97..a9e48ad 100644
--- a/package/mysql/mysql.mk
+++ b/package/mysql/mysql.mk
@@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
 MYSQL_LICENSE = GPLv2
 MYSQL_LICENSE_FILES = README COPYING
 
+# Variable with default socket location for other buildroot packages to use
+MYSQL_SOCKET = /tmp/mysql.sock
+
 MYSQL_CONF_ENV = \
 	ac_cv_sys_restartable_syscalls=yes \
 	ac_cv_path_PS=/bin/ps \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] package/php: Set MySQL socket path
  2016-09-08 14:33 [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
@ 2016-09-08 14:33 ` Floris Bos
  2016-09-08 14:44 ` [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Yann E. MORIN
  1 sibling, 0 replies; 6+ messages in thread
From: Floris Bos @ 2016-09-08 14:33 UTC (permalink / raw)
  To: buildroot

If the buildroot MySQL server is being build set the
PHP default MySQL socket path to match what the server is using.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
 package/php/php.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/php/php.mk b/package/php/php.mk
index deaf56e..86a8ca0 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -210,6 +210,13 @@ PHP_DEPENDENCIES += unixodbc
 endif
 endif
 
+ifneq ($(BR2_PACKAGE_PHP_EXT_MYSQLI)$(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),)
+ifeq ($(BR2_PACKAGE_MYSQL_SERVER),y)
+# Set default MySQL unix socket to what the MySQL server is using by default
+PHP_CONF_OPTS += --with-mysql-sock=$(MYSQL_SOCKET)
+endif
+endif
+
 define PHP_DISABLE_PCRE_JIT
 	$(SED) '/^#define SUPPORT_JIT/d' $(@D)/ext/pcre/pcrelib/config.h
 endef
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable
  2016-09-08 14:33 [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
  2016-09-08 14:33 ` [Buildroot] [PATCH 2/2] package/php: Set MySQL socket path Floris Bos
@ 2016-09-08 14:44 ` Yann E. MORIN
  2016-09-08 15:27   ` Floris Bos
  1 sibling, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2016-09-08 14:44 UTC (permalink / raw)
  To: buildroot

Floris, All,

On 2016-09-08 16:33 +0200, Floris Bos spake thusly:
> Add MYSQL_SOCKET variable with default socket location for other
> packages to use.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> ---
>  package/mysql/mysql.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/package/mysql/mysql.mk b/package/mysql/mysql.mk
> index 534bd97..a9e48ad 100644
> --- a/package/mysql/mysql.mk
> +++ b/package/mysql/mysql.mk
> @@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
>  MYSQL_LICENSE = GPLv2
>  MYSQL_LICENSE_FILES = README COPYING
>  
> +# Variable with default socket location for other buildroot packages to use
> +MYSQL_SOCKET = /tmp/mysql.sock

Should we also use that location in the sysv startup script and systemd
unit?

If that is the default of mysql, is there a way to force it during
configure? I'm a bit uneasy to rely on magic values, in case a future
version changes this default location...

Regards,
Yann E. MORIN.

>  MYSQL_CONF_ENV = \
>  	ac_cv_sys_restartable_syscalls=yes \
>  	ac_cv_path_PS=/bin/ps \
> -- 
> 2.7.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable
  2016-09-08 14:44 ` [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Yann E. MORIN
@ 2016-09-08 15:27   ` Floris Bos
  2016-09-08 20:21     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Floris Bos @ 2016-09-08 15:27 UTC (permalink / raw)
  To: buildroot

On 09/08/2016 04:44 PM, Yann E. MORIN wrote:
> Floris, All,
>
> On 2016-09-08 16:33 +0200, Floris Bos spake thusly:
>> Add MYSQL_SOCKET variable with default socket location for other
>> packages to use.
>>
>> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
>> ---
>>   package/mysql/mysql.mk | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/package/mysql/mysql.mk b/package/mysql/mysql.mk
>> index 534bd97..a9e48ad 100644
>> --- a/package/mysql/mysql.mk
>> +++ b/package/mysql/mysql.mk
>> @@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
>>   MYSQL_LICENSE = GPLv2
>>   MYSQL_LICENSE_FILES = README COPYING
>>   
>> +# Variable with default socket location for other buildroot packages to use
>> +MYSQL_SOCKET = /tmp/mysql.sock
> Should we also use that location in the sysv startup script and systemd
> unit?
>
> If that is the default of mysql, is there a way to force it during
> configure? I'm a bit uneasy to rely on magic values, in case a future
> version changes this default location...

Yes, could force it to use that value with a --with-unix-socket-path= 
configure option or in the server configuration file.


Do note that while /tmp is the upstream default for all MySQL versions, 
it is naturally not the safest location for multi-user systems.
If an unprivileged user gains access to the system sooner than MySQL is 
up & running, he could create his own /tmp/mysql.sock and intercept 
authentication details and queries of clients connecting.
So normal Linux distributions would override the default to a different 
location, e.g. under /var/run
Something we could also consider, if we want to set the socket path anyway.


OTOH do note that the MySQL branch we currently have has been EOL for 3 
years, and newer versions uses a totally different (cmake based) build 
system.
So personally I am not that keen to spend too much time patching up the 
current package either.
Might be better to create a brand new one for a later MySQL (or MariaDB) 
version, but that would take some time.


Yours sincerely,

Floris Bos

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable
  2016-09-08 15:27   ` Floris Bos
@ 2016-09-08 20:21     ` Thomas Petazzoni
  2016-09-09 11:29       ` Floris Bos
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2016-09-08 20:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 8 Sep 2016 17:27:24 +0200, Floris Bos wrote:

> > If that is the default of mysql, is there a way to force it during
> > configure? I'm a bit uneasy to rely on magic values, in case a future
> > version changes this default location...  
> 
> Yes, could force it to use that value with a --with-unix-socket-path= 
> configure option or in the server configuration file.

That would be a good idea.

> 
> 
> Do note that while /tmp is the upstream default for all MySQL versions, 
> it is naturally not the safest location for multi-user systems.
> If an unprivileged user gains access to the system sooner than MySQL is 
> up & running, he could create his own /tmp/mysql.sock and intercept 
> authentication details and queries of clients connecting.
> So normal Linux distributions would override the default to a different 
> location, e.g. under /var/run

So why not use --with-unix-socket-path=/var/run/mysql.sock ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable
  2016-09-08 20:21     ` Thomas Petazzoni
@ 2016-09-09 11:29       ` Floris Bos
  0 siblings, 0 replies; 6+ messages in thread
From: Floris Bos @ 2016-09-09 11:29 UTC (permalink / raw)
  To: buildroot

On 09/08/2016 10:21 PM, Thomas Petazzoni wrote:
> On Thu, 8 Sep 2016 17:27:24 +0200, Floris Bos wrote:
>
>>> If that is the default of mysql, is there a way to force it during
>>> configure? I'm a bit uneasy to rely on magic values, in case a future
>>> version changes this default location...
>> Yes, could force it to use that value with a --with-unix-socket-path=
>> configure option or in the server configuration file.
> That would be a good idea.
>
>>
>> Do note that while /tmp is the upstream default for all MySQL versions,
>> it is naturally not the safest location for multi-user systems.
>> If an unprivileged user gains access to the system sooner than MySQL is
>> up & running, he could create his own /tmp/mysql.sock and intercept
>> authentication details and queries of clients connecting.
>> So normal Linux distributions would override the default to a different
>> location, e.g. under /var/run
> So why not use --with-unix-socket-path=/var/run/mysql.sock ?

Ok, submitted a v2.
Still needs the second PHP part as well.


However someone else would need to check and test the systemd change, as 
I am never having much luck getting systemd to just work with buildroot.
"Timed out waiting for device dev-console.device" this time and no login 
prompt.
"Dependency failed for Serial Getty on console"
And no easy way to login by SSH either, given "*** automatic network 
configuration via DHCP is not compatible with networkd ***"


Yours sincerely,

Floris Bos

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-09 11:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 14:33 [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
2016-09-08 14:33 ` [Buildroot] [PATCH 2/2] package/php: Set MySQL socket path Floris Bos
2016-09-08 14:44 ` [Buildroot] [PATCH 1/2] package/mysql: add MYSQL_SOCKET variable Yann E. MORIN
2016-09-08 15:27   ` Floris Bos
2016-09-08 20:21     ` Thomas Petazzoni
2016-09-09 11:29       ` Floris Bos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.