Why can't I use <date> selector on an ant <dirset>? - ant

I have three files and three directories in a directory, with varying dates.
$ cd mydir
$ ls -ltr
-rw-rw-r-- 1 skiphoppy users 0 Nov 14 00:00 file.old.20121114
drwxrwxrwx 2 skiphoppy users 4096 Nov 14 00:00 dir.old.20121114
drwxrwxrwx 2 skiphoppy users 4096 Dec 5 12:05 dir.old.20121205
drwxrwxrwx 2 skiphoppy users 4096 Dec 5 12:05 dir
-rw-rw-r-- 1 skiphoppy users 0 Dec 5 12:16 file.old.20121205
-rw-rw-r-- 1 skiphoppy users 0 Dec 5 12:16 file
I want to build a dirset that includes all directories older than 2012-12-01. If I am reading right, the selector can be used to limit the files returned. But it appears this doesn't work for a dirset, even though the dirset documentation says you can use nested patternsets and selectors.
If I use the date selector on a fileset, I get just the one old file that I would expect; but with the same syntax on a dirset, I get all directories:
<fileset id="old.files" dir="mydir">
<date datetime="12/01/2012 12:00 AM" when="before"/>
</fileset>
<echo message="Files: ${toString:old.files}"/>
<dirset id="old.dirs" dir="mydir">
<date datetime="12/01/2012 12:00 AM" when="before"/>
</dirset>
<echo message="Dirs: ${toString:old.dirs}"/>
Output:
[echo] Files: file.old.20121114
[echo] Dirs: ;dir;dir.old.20121114;dir.old.20121205
What is going on here that the date selector does not work?

You probably need the checkdirs attribute set for the date selector. The default is 'false', i.e. select everything.
<date datetime="12/01/2012 12:00 AM" when="before" checkdirs="true" />

Related

What does "dot slash dot" (./.) mean in a Nix expression?

Wherever I see flake-compat used, it is a variation of
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = ./.;
}).shellNix
It is obviously a path that refers to the current directory which can be proven with a simple test:
[~/testdir]$ ll .
total 24
drwxr-xr-x 2 toraritte users 4096 Jul 21 21:56 ./
drwx------ 7 toraritte users 20480 Jul 15 23:13 ../
-rw-r--r-- 1 toraritte users 0 Jul 21 21:56 lofa
[~/testdir]$ ll ./.
total 24
drwxr-xr-x 2 toraritte users 4096 Jul 21 21:56 ./
drwx------ 7 toraritte users 20480 Jul 15 23:13 ../
-rw-r--r-- 1 toraritte users 0 Jul 21 21:56 lofa
So why not simply use .?
From 5.2.1 Values section of the Nix manual (emphasis mine):
Paths, e.g., /bin/sh or ./builder.sh. A path must contain at least one
slash to be recognised as such.
For instance, builder.sh is not a
path: it's parsed as an expression that selects the attribute sh from
the variable builder. If the file name is relative, i.e., if it does
not begin with a slash, it is made absolute at parse time relative to
the directory of the Nix expression that contained it. For instance,
if a Nix expression in /foo/bar/bla.nix refers to ../xyzzy/fnord.nix,
the absolute path is /foo/xyzzy/fnord.nix.

Lua can't import a module and says file not found but the file exists

i'm trying to run a lua script from inside haproxy that imports the "pgmoon" library. i can import pgmoon and get as far as opening a socket, but then i run into this:
[ALERT] 082/234313 (8) : Lua function 'queue-request': runtime error: /usr/local/share/lua/5.3/pgmoon/init.lua:269: module 'pgmoon.crypto' not found:
no field package.preload['pgmoon.crypto']
no file '/usr/local/share/lua/5.3/pgmoon/crypto.lua'
no file '/usr/local/share/lua/5.3/pgmoon/crypto/init.lua'
no file '/usr/local/lib/lua/5.3/pgmoon/crypto.lua'
no file '/usr/local/lib/lua/5.3/pgmoon/crypto/init.lua'
no file '/usr/share/lua/5.3/pgmoon/crypto.lua'
no file '/usr/share/lua/5.3/pgmoon/crypto/init.lua'
no file './pgmoon/crypto.lua'
no file './pgmoon/crypto/init.lua'
no file '/usr/local/lib/lua/5.3/pgmoon/crypto.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/pgmoon/crypto.so'
no file '/usr/lib/lua/5.3/pgmoon/crypto.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './pgmoon/crypto.so'
no file '/usr/local/lib/lua/5.3/pgmoon.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/pgmoon.so'
no file '/usr/lib/lua/5.3/pgmoon.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './pgmoon.so' from [C] global 'require', /usr/local/share/lua/5.3/pgmoon/init.lua:269 C function line 267 ..., /usr/local/share/lua/5.3/pgmoon/init.lua:211 method 'connect', /usr/local/haproxy/queue-request.lua:38 C function line 25.
however, there is a file at /usr/local/share/lua/5.3/pgmoon/crypto.lua, this is what ls shows:
# ls -la /usr/local/share/lua/5.3/pgmoon/
total 60
drwxr-xr-x 1 root root 4096 Mar 24 23:42 .
drwxr-xr-x 1 root root 4096 Mar 24 23:00 ..
-rw-r--r-- 1 root root 2880 Mar 24 23:00 arrays.lua
-rw-r--r-- 1 root root 1130 Mar 24 23:00 bit.lua
-rw-r--r-- 1 root root 1587 Mar 24 23:00 cqueues.lua
-rw-r--r-- 1 root root 654 Mar 24 23:00 crypto.lua
-rw-r--r-- 1 root root 2084 Mar 24 23:00 hstore.lua
-rw-r--r-- 1 root root 20127 Mar 24 23:00 init.lua
-rw-r--r-- 1 root root 665 Mar 24 23:00 json.lua
-rw-r--r-- 1 root root 2728 Mar 24 23:42 socket.lua
-rw-r--r-- 1 root root 457 Mar 24 23:00 util.lua
i could see it being permissions-related, if the haproxy user couldn't access a root owned file, but by the time it gets here it's already executed init.lua which has imported socket.lua and they've all got the same permissions...
Anybody know why lua thinks there is no file at crypto.lua?
I guess that you have haproxy configured with chroot and there actually isn't a file at /usr/local/share/lua/5.3/pgmoon/crypto.lua - in the chroot you haproxy runs in.
The require('pgmoon.crypto') in init.lua is within a function and probably tries to run long after Haproxy and lua initialization - and the root change.
And somewhat (un)relatedly - you can probably expect other problems with the pgmoon not being aware of haproxy, eg. its use of luasocket and not the haproxy-provided replacement: https://www.haproxy.com/blog/5-ways-to-extend-haproxy-with-lua/
The Socket class is a replacement for the standard Lua Socket class and is compatible with HAProxy’s non-blocking nature. When you want to use socket functions in your actions, you must use this class.

Jenkins can't find artifacts

I have a jenkins running a job, after which I want it to "archive artifact", which is basically just get some files.
The Job clones a github and when ran, it generates some log files which I need.
The patter is:
logfiles/*
I added a command to list the directory to make sure the files are there, and indeed they are.
+ ls -la logfiles
total 24
drwxr-xr-x 2 root root 4096 Apr 22 23:23 .
drwxr-xr-x 8 root root 4096 Apr 22 23:23 ..
-rw-r--r-- 1 root root 0 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41.log
-rw-r--r-- 1 root root 1248 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_shortmsg.csv
-rw-r--r-- 1 root root 2521 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_stats.log
-rw-r--r-- 1 root root 8035 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_trace_msg.log
Archiving artifacts
ERROR: No artifacts found that match the file pattern "logfiles/*". Configuration error?
ERROR: ‘logfiles/*’ doesn’t match anything, but ‘*’ does. Perhaps that’s what you mean?
Build step 'Archive the artifacts' changed build result to FAILURE
I don't really understand why they are not found.
Hope someone can help!
Thanks!
I finally found my problem. I had configured the job to do the git clone. But for some reason I also added the cloning on the build steps... once i removed that jenkins started getting the files properly.
I would still like to understand why this would happen...
Thanks to all

Log4j 2 rollover not happening at expected time

I am using log4j2 Rolling File appender for logging. The traffic for the logger is quite sparse. I want the logger to rollover the file at the appropriate time. How can i do that ?
This is the output of ls -lrth command on the log files.
-rw-r--r-- 1 root root 136 Apr 27 15:51 logfile-04-20150427-07-00.log.gz
-rw-r--r-- 1 root root 133 Apr 27 23:18 logfile-04-20150427-15-00.log.gz
-rw-r--r-- 1 root root 151 Apr 28 04:40 logfile-04-20150427-23-00.log.gz
-rw-r--r-- 1 root root 161 Apr 28 05:14 logfile-04-20150428-04-00.log.gz
-rw-r--r-- 1 root root 134 Apr 28 06:45 logfile-04-20150428-05-00.log.gz
-rw-r--r-- 1 root root 125 Apr 28 08:46 logfile-04-20150428-06-00.log.gz
-rw-r--r-- 1 root root 191 Apr 28 09:27 logfile-04-20150428-08-00.log.gz
-rw-r--r-- 1 root root 281 Apr 28 10:43 logfile-04-20150428-09-00.log.gz
Clearly the logger is not rotating the logfile at the apt time. (see the modification time of the file and the logfile timestamp).
The following is my log4j2.xml configuration for the logger.
<RollingFile name="userlogfileAppender"
fileName="${sys:catalina.home}/webapps/miscLogs/uData/logfile/logfile.log"
filePattern="${sys:catalina.home}/webapps/miscLogs/uData/logfile/logfile-${logfileId}-%d{yyyyMMdd-HH}-00.log.gz"
immediateFlush="true"
bufferedIO="false">
<PatternLayout>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
</RollingFile>
<logger additivity="false" name="userlogfileLogger" level="debug">
<AppenderRef ref="userlogfileAppender"/>
Rollover is not driven by a timer in log4j2, but by log events. The rollover appender will compare the timestamp of the log event with the scheduled rollover time, and if the rollover time has been exceeded, then the file is rolled over.
This means that if traffic is sparse, there will often not be a log event that triggers a rollover at the scheduled rollover time. Rollover will occur at the next event after the scheduled rollover time, which may be hours later.
Log4j2 currently does not have a timer mechanism to force rollover. Depending on how mission-critical this is, you can create a timer in your application that logs an event once an hour to force a rollover.

JQuery-UI and Bootstrap Conflicts

I have a Rails 3.2.5 app that is using Twitter Bootstrap. I am trying to use the JQuery UI datepicker. I have Googled this for days looking for a solution and can't find anything. I have a text field in a Rails view that I am trying to use with the JQuery datepicker. However, when I click in the text field, nothing happens.
In my Rails view, I have a simple text_field_tag like so:
<%= text_field_tag 'andrew' %>
In my associated CoffeeScript file:
$ ->
$('#andrew').datepicker
In the Chrome Developer Tools JavaScript Console, I see this error:
Uncaught TypeError: Object [object Object] has no method 'datepicker'
Now I have determined there is a conflict between JQuery-UI and Bootstrap. In that same JavaScript console, I can do this:
jQuery.noConflict();
and I get
function (a,b){return new e.fn.init(a,b,h)}
Then I can type:
$('andrew'.datepicker();
And I get:
[<input id="andrew" name="andrew" type="text" class="hasDatepicker">]
After this, when I go over to the browser window, clicking in the text field brings up the datepicker calendar just like I want it to.
So how do I get this to work in my code? That is, I am manually resolving the conflict in the JavaScript Console but I can't get it to work just through my code.
It looks like I have this one solved after much pain. I created a new project and slowly, methodically moved over pieces of my application to the new app. I finally uncovered a directory that was only in my project with the problem described above.
There was a 'public/assets' directory with the contents below. I don't recall creating this directory or putting these files in that directory. Renaming the directory to something different caused my JQuery-UI datepicker to work properly in conjunction with Twitter Bootstrap.
Here are the contents of public/assets:
-rw-r--r-- 1 andrunix staff 83360 Sep 3 18:01 application 6fc1172d858485077bbecdb82b96399a.css
-rw-r--r-- 1 andrunix staff 13546 Sep 3 18:01 application-6fc1172d858485077bbecdb82b96399a.css.gz
-rw-r--r-- 1 andrunix staff 100616 Sep 3 18:01 application-990a4cf0df42934fcc4c14aaf88b7ced.js
-rw-r--r-- 1 andrunix staff 35448 Sep 3 18:01 application-990a4cf0df42934fcc4c14aaf88b7ced.js.gz
-rw-r--r-- 1 andrunix staff 83294 Sep 3 18:01 application.css
-rw-r--r-- 1 andrunix staff 13484 Sep 3 18:01 application.css.gz
-rw-r--r-- 1 andrunix staff 100618 Sep 6 20:26 application.js
-rw-r--r-- 1 andrunix staff 35448 Sep 3 18:01 application.js.gz
-rw-r--r-- 1 andrunix staff 13826 Aug 30 17:42 glyphicons-halflings-f6675c325532ec11a984d58e172b8e2a.png
-rw-r--r-- 1 andrunix staff 8777 Aug 30 17:42 glyphicons-halflings-white-13553a5bf21ae3cc374006592488ec64.png
-rw-r--r-- 1 andrunix staff 8777 Aug 30 17:42 glyphicons-halflings-white.png
-rw-r--r-- 1 andrunix staff 13826 Aug 30 17:42 glyphicons-halflings.png
-rw-r--r-- 1 andrunix staff 368 Sep 5 15:00 manifest.yml
-rw-r--r-- 1 andrunix staff 6646 Aug 10 19:57 rails-be8732dac73d845ac5b142c8fb5f9fb0.png
-rw-r--r-- 1 andrunix staff 6646 Aug 10 19:57 rails.png
If anyone knows how this got created, that would put my mind at ease. Thanks!
Andrew

Resources