Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15163
| Path | csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Travis Everett <travis.a.everett@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | printf builtin retains timezone from un-set TZ environment variable |
| Date | Sat, 13 Jul 2019 12:31:31 -0500 |
| Lines | 60 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1214.1563051807.2688.bug-bash@gnu.org> (permalink) |
| References | <CAC=jSUUA7KAWbm14VBHNRUsZVUNgpLYT2bZ094dJA9gb2on+3w@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1563051808 31956 209.51.188.17 (13 Jul 2019 21:03:28 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=znZai8Zx2ssqyg9HDz4NRg26TPXaipMZdmCzrzQcVnQ=; b=ALGxivm6xyz53q4WSTSQtdbndSI9mIgVxPmlhRSL0oodiNjKoUQHn2kLfUHr6L728R s5Z+DIvEaRRfYwIsfQxNkgC6qUXl6POww/j8lWE9CHA/tCqS9O1VZL4WNBQP2UsjQBA1 1hDs/ZNVc3THJFQktqihuYubpRVtWfQJjKblu8ZrC4ohpkoPk2T82I2kALuBgAoDM3Yt AFrmA0wpLC2uNi7BqtP4Tqs5ec23h3azOQYrXCiSYr9so7cIUFkTiEBnpnqBMZobPMzW mTpMN9VwNQm9DtaKMYKGze5RNlOIyX7CKN9Fp3SmLYaNqxpUIIoNYfuM8Z50Xacd0iX+ MaUg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=znZai8Zx2ssqyg9HDz4NRg26TPXaipMZdmCzrzQcVnQ=; b=FbpeMDx4UjXgMSvFf0377G+oxopzyIm+UypedZJmQ2W5O87kMqoPmUU3K/y1oJOn6M C0LWYmwfSMboW5rCJzP5HjdHnKfBMDNONfDB6LYTAbSLGx9WtPWNdl/mpCZb5uXaPGt9 RJFEdN6v2V8f5VccnlX4w7fAThWQKHTZBZJECffZHrE0XMPc5zAirURoYAu31cWr9S6n e7OnFKRi130ZWg2EGcn35ES05jWp9dZKJYBoCNK5fIMgoYEOLRggl5jlIHvegNE5half ee48wOlTd/D4D8hsk1xELp1kmTgR7ZZOp1bq35cIDjyYVO8W2f6/yvuWe905tSpfrBiC 12uA== |
| X-Gm-Message-State | APjAAAXDWD0V+fsKSE/SXhLAI9RdaSwWHzCNubZL3LXZ6x3KyVDq5l3G DwBDDSm8W6VTtZA9TT1yZyjamGDeRGXEOs0ek44+/6Ct6C4= |
| X-Google-Smtp-Source | APXvYqzotkVEez6iyoO7LsQA1EwP3haLQYQpctymgK54crRP6m8TkLWXnVUeqHoSy+e+TrC4W4CCveAliBloxHIykP8= |
| X-Received | by 2002:a67:fd88:: with SMTP id k8mr11544274vsq.41.1563039102542; Sat, 13 Jul 2019 10:31:42 -0700 (PDT) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::e2a |
| X-Mailman-Approved-At | Sat, 13 Jul 2019 17:03:25 -0400 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.23 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAC=jSUUA7KAWbm14VBHNRUsZVUNgpLYT2bZ094dJA9gb2on+3w@mail.gmail.com> |
| Xref | csiph.com gnu.bash.bug:15163 |
Show key headers only | View raw
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: darwin17.7.0 Compiler: clang Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Darwin f638f97d 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PD$ Machine Type: x86_64-apple-darwin17.7.0 Bash Version: 5.0 Patch Level: 7 Release Status: release *Description:* I've noticed that a timezone explicitly set in the TZ environment variable can get cached (if any date-using command/builtin is run) and then show up (at least) in dates produced by the printf builtin's "%(...)T" formats even after the TZ variable is unset. I played around with this for a bit and identified two ways to get the timezone to re-set: - Run an external command. I have yet to find an external command that didn't correct it, so I suspect this behavior is intrinsic to the API calls made when running an external command. It's also possible I'm too unimaginative to find an external command that *doesn't* invoke date APIs :). - Set the TZ variable inline and run any builtin (i.e., `TZ=:/etc/localtime :`). *Repeat-By:* ---- tzcache.sh ---- echo $BASH_VERSION export TZ=Antarctica/South_Pole printf "TZ: $TZ\n\t%(%+)T\n" unset TZ # still prints the now-unset timezone printf "TZ: $TZ\n\t%(%+)T\n" # to reset it # run any external command # or any builtin with an inline TZ setting TZ=:/etc/localtime : printf "TZ: $TZ\n\t%(%+)T\n" -------------------- $ env -i $(which bash) --norc --noprofile tzcache.sh 5.0.7(1)-release TZ: Antarctica/South_Pole Sun Jul 14 05:21:49 NZST 2019 TZ: Sun Jul 14 05:21:49 NZST 2019 TZ: Sat Jul 13 12:21:49 CDT 2019 Cheers, Travis
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
printf builtin retains timezone from un-set TZ environment variable Travis Everett <travis.a.everett@gmail.com> - 2019-07-13 12:31 -0500
csiph-web