Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 527594 - dev-db/oracle-instantclient-basic silently overrides user's setting in config on re-emerge
Summary: dev-db/oracle-instantclient-basic silently overrides user's setting in config...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Haubenwallner (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 524922
  Show dependency tree
 
Reported: 2014-10-31 10:23 UTC by Sergey S. Starikoff
Modified: 2016-03-09 15:59 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey S. Starikoff 2014-10-31 10:23:54 UTC
Using dev-db/oracle-instantclient-sqlplus I find insufficient standardly provided three variables (ORACLE_HOME, LDPATH and TNS_ADMIN).
Using only them on my UTF8 localized workstation sqlplus shows '???'s instead of cyrillic symbols when connecteng to non-UTF8 database.
After adding to /etc/env.d/50oracle-instantclient-basic config file proper variable:
NLS_LANG=RUSSIAN_RUSSIA.AL32UTF8
sqlplus works correctly.

But after re-emerge dev-db/oracle-instantclient-basic (last time it was a check for bug #524922) I find /etc/env.d/50oracle-instantclient-basic config overwritten, with restoring three default variables.
So, sqlplus client is broken again.

Together with resetting all user's settings, it forces usage TNS_ADMIN=/etc/oracle/
Even if user want to change it.

I suggest to modify =dev-db/oracle-instantclient-basic-11.2.0.4-r1 to use not one, but two configs:
Now present automatically updated /etc/env.d/50oracle-instantclient-basic for (ORACLE_HOME and LDPATH) and just initially created, but never updated /etc/env.d/52oracle-instantclient-basic.extra for TNS_ADMIN and other setting user may need.

With proper warning about /etc/env.d/50oracle-instantclient-basic in pkg_postint message.
Comment 1 Michael Haubenwallner (RETIRED) gentoo-dev 2014-10-31 13:43:55 UTC
(In reply to Sergey S. Starikoff from comment #0)
> After adding to /etc/env.d/50oracle-instantclient-basic config file proper
> variable:
> NLS_LANG=RUSSIAN_RUSSIA.AL32UTF8

Would it work for you to put NLS_LANG into either your ~/.profile or even
/etc/env.d/99oracle? Same for TNS_ADMIN.

> Together with resetting all user's settings, it forces usage
> TNS_ADMIN=/etc/oracle/
> Even if user want to change it.

The values in /etc/env.d/99oracle-instantclient-basic are intended as defaults, and users (or even projects) override (TNS_ADMIN) or set (NLS_LANG) them somewhere else, like:
   host: /etc/env.d/99oracle
  users: ~/.profile
project: project environment

> With proper warning about /etc/env.d/50oracle-instantclient-basic in
> pkg_postint message.

While I could add messages, overriding things like above somehow feels like "business as usual", not specific to oracle-instantclient at all, no?
Comment 2 Sergey S. Starikoff 2014-11-05 11:55:43 UTC
(In reply to Michael Haubenwallner from comment #1)
> Would it work for you to put NLS_LANG into either your ~/.profile or even
> /etc/env.d/99oracle? Same for TNS_ADMIN.
It works even if  proper value of NLS_LANG is set as environment variable (just export NLS_LANG=…).
And one more: correct setting the NLS_LANG variable is necessary everywhere, when user uses non-default locale. I.e. if user set LINGUAS variable in make.conf, he probably need to setup NLS_LANG.


> > Together with resetting all user's settings, it forces usage
> > TNS_ADMIN=/etc/oracle/
> > Even if user want to change it.
> 
> The values in /etc/env.d/99oracle-instantclient-basic are intended as
> defaults, and users (or even projects) override (TNS_ADMIN) or set
> (NLS_LANG) them somewhere else, like:
>    host: /etc/env.d/99oracle
>   users: ~/.profile
> project: project environment
Yes.
Maybe only add einfo message on non-default LINGUAS value, that user probably needs to setup proper value of NLS_LANG.
Format: NLS_LANG = language_territory.charset
For detailed description see http://docs.oracle.com/cd/E11882_01/server.112/e10729/applocaledata.htm

And add a header like:
# /etc/env.d/99oracle-instantclient-basic
# Do not edit this file, to extend/override it's settings use /etc/env.d/99oracle


> > With proper warning about /etc/env.d/50oracle-instantclient-basic in
> > pkg_postint message.
> While I could add messages, overriding things like above somehow feels like
> "business as usual", not specific to oracle-instantclient at all, no?

Strictly speaking, client default (used in current Gentoo installation) already overrides Oracle's default.
TNS_ADMIN for database server (seen just now): /ora/app/oracle/product/11.2.0/dbhome_1/network/admin/
The default for Oracle's Instantclient I don't remember.
For non-English languages setting NLS_LANG is really needed.
Comment 3 Sergey S. Starikoff 2014-11-20 13:56:09 UTC
(In reply to Michael Haubenwallner from comment #1)
> The values in /etc/env.d/99oracle-instantclient-basic are intended as
> defaults, and users (or even projects) override (TNS_ADMIN) or set
> (NLS_LANG) them somewhere else, like:
> …
>   users: ~/.profile
> …

Maybe mostly as a question for separate bug:
For now =sys-apps/baselayout-2.2 don't install /etc/skel/.profile
So, default user have to create this file.

Also there is a question about shell-compatibility.
/etc/profile:
# That this file is used by any Bourne-shell derivative to setup the
# environment for login shells.

Of course, portage requires bash.
But are _all_ modern shells bash-compatible?
Comment 4 Michael Haubenwallner (RETIRED) gentoo-dev 2014-11-21 07:59:59 UTC
(In reply to Sergey S. Starikoff from comment #3)
> (In reply to Michael Haubenwallner from comment #1)
> > The values in /etc/env.d/99oracle-instantclient-basic are intended as
> > defaults, and users (or even projects) override (TNS_ADMIN) or set
> > (NLS_LANG) them somewhere else, like:
> > …
> >   users: ~/.profile
> > …
> 
> Maybe mostly as a question for separate bug:
> For now =sys-apps/baselayout-2.2 don't install /etc/skel/.profile
> So, default user have to create this file.

Eventually yes. However, documenting how to set up users login environment is beyond this package.

> Also there is a question about shell-compatibility.
> /etc/profile:
> # That this file is used by any Bourne-shell derivative to setup the
> # environment for login shells.
> 
> Of course, portage requires bash.
> But are _all_ modern shells bash-compatible?

No, but modern shells are Bourne-shell compatible - which is what /etc/profile does require. That portage's requirement goes beyond Bourne-shell is irrelevant here.
Comment 5 Michael Haubenwallner (RETIRED) gentoo-dev 2016-03-09 13:19:21 UTC
(In reply to Michael Haubenwallner from comment #4)
> No, but modern shells are Bourne-shell compatible - which is what
> /etc/profile does require.

Erm, IIRC /etc/profile is POSIX-compatible for modern shells.
Comment 6 Michael Haubenwallner (RETIRED) gentoo-dev 2016-03-09 15:59:59 UTC
dev-db/oracle-instantclient-12.1.0.2 now does install a template
/etc/env.d/99oracle-instantclient when it does not exist, or does copy the old one otherways.
However, now having that said, this feels a little awkward...

Instead, it would be more correct to let etc-update/dispatch-conf/etc. do that job. But that requires some other location than /etc/env.d/ for the config-file.
Anyway, fixed for now.