Length of a video file (.avi, .mpg) from the command line

2019-08-14 Thread Jean-Baptiste Thomas
Can anyone recommend a command line program that could tell me
the length of the video stream in a .avi or .mpg file ? Thanks
in advance.



Anonymising email service providers

2018-07-22 Thread Jean-Baptiste Thomas
Looking for email service providers that anonymise outgoing email. More
specifically, accept submissions through SMTP but do not show the IP
address of the system of origin in the Received: header added by their
MTA.

Including the originating IP address in an ad-hoc header to prevent
abuse does not bother me as long as the IP address is encrypted in such
way that only the provider can get to it.

riseup.net hide the IP address of origin but new accounts are by
invitation only.

protonmail.ch probably do too but they are not ideal for other reasons.

Do you know others ? TIA.



Re: apt{-cache,-get,itude} show wrong version of package after update

2018-04-02 Thread Jean-Baptiste Thomas
>> What I'd like to know now is : what prevents apt-get from
>> downloading the Packages file from the mirror ? Wget can !
>
> Move all the files out of /var/lib/apt/lists/ so that apt-get update
> has to download fresh copies. That should get you back on track.
> 
> By all means take the opportunity to compare the old and the new files
> to look for causes. In the simplest scenario, which probably is not
> the cause but might illustrate the kind of problem, a failed download
> could leave a file with a timestamp at the point of failure. That
> erroneous timestamp would be more recent than the mirror's (correct)
> timestamp and could cause update to think there's nothing to do on
> subsequent runs until the original file on the mirror was modified.

The problem is not that apt-get sees the new Packages file and
decides that it does not need to be downloaded. If that were the
case, the output would be

  Hit http://mymirror/debian stretch/main amd64 Packages

The actual output is

  Ign:5 http://mymirror/debian stretch/main amd64 Packages

which indicates that it tried to download it but failed. At
least if the link I gave previously is correct (and it appears
to be).

The reason why it failed is that it looked for Packages.xz which
did not exist on my mirror. The reason why my mirror did not
have a Packages.xz file is that it was made with the version of
debmirror in Debian 8, which only concerns itself with
Packages.gz and Packages.bz2.

Those files *were* there and apt-get could have used them but,
in its wisdom, it didn't even try.

I solved the problem by installing the latest version of
debmirror on the Debian 8 machine where the mirror is.
Thankfully, there were no dependency problems.

There is probably material for a few bug reports in there.

Thank you.



Re: apt{-cache,-get,itude} show wrong version of package after update

2018-03-28 Thread Jean-Baptiste Thomas
> Try running:
> sudo apt-get update # one more time, to be sure
> # then
> apt-cache policy ntp
>
> and see what version it refers to.

Thanks for the suggestions folks but there's not much to see
there, no packages are pinned.

I've made some progress, though. A closer look at the output
reveals that "Packages" is "Ign:", which is apparently [1]
apt-get's way of saying "I was unable to download it but that's
not a problem".

  # apt-get update
  Ign:1 http://mymirror/debian stretch InRelease
  [...]
  Get:3 http://mymirror/debian stretch Release [118 kB]
  Get:4 http://mymirror/debian stretch Release.gpg [2434 B]
  Ign:5 http://mymirror/debian stretch/main amd64 Packages
  [...]

strace tells me that apt-get uses the cached version in
/var/lib/apt/lists/, which may be why it thinks that not being
able to download it is not a problem.

Unfortunately, the Packages file in /var/lib/apt/lists/ is out
of date by months because it pertains to 9.2 while the mirror
has 9.4. Diffing the two shows why apt-get looks for the wrong
version of ntp :

 Package: ntp
-Version: 1:4.2.8p10+dfsg-3+deb9u1
+Version: 1:4.2.8p10+dfsg-3+deb9u2
 Installed-Size: 1804

What I'd like to know now is : what prevents apt-get from
downloading the Packages file from the mirror ? Wget can !

[1] https://superuser.com/questions/454867/



apt{-cache,-get,itude} show wrong version of package after update

2018-03-27 Thread Jean-Baptiste Thomas
After apt-get update, attempting to install ntp tries to
download version 1:4.2.8p10+dfsg-3+deb9u1 and fails. It tries
to download +deb9u1 because

  $ aptitude show ntp
  Package: ntp
  Version: 1:4.2.8p10+dfsg-3+deb9u1
  State: not installed
  [...]

and it fails because the version of the package in the Debian 9
mirror listed in /etc/apt/sources.list is +deb9u2 :

  ntp_4.2.8p10+dfsg-3+deb9u2_amd64.deb

I don't understand what went wrong. apt-get update seemed to go
well, only complaining about missing "DEP-11 64x64 Icons", which
are presumably not a vital part of ntp.

How is this possible ? I'm confused.



Re: error "sh: 1: exec: ...: File exists" with dash

2016-03-03 Thread Jean-Baptiste Thomas
EEXIST does sounds like a strange reason for exec(2) to fail.
Did you strace -f to confirm that EEXIST is indeed set by
execve() ?

I've seen weirdly-named files appear in NFS-exported file
systems. I seem to remember they were related to deleted files
but it might happen in other circumstances. A name collision
could explain EEXIST. I would take a look on the NFS server.

Assuming you've managed to successfully use IPC::Open2::open2
on other executables in the same NFS-mounted file system and
it is only mymaple that fails : if mymaple is a script, what is
it's shebang line ? Is file creation involved somehow ?

Shot in the dark : does the error go away if you remove the
"2>&1" part ?



Re: Debian as My home firewall/router

2016-03-02 Thread Jean-Baptiste Thomas
> I like to avoid the latest and greatest (especially Debian
> latest and greatest, vide infra).

"Debian vide infra" ? What's that ?



Re: systemd and bash scripts

2016-02-27 Thread Jean-Baptiste Thomas
Careful, it looks like your mailer breaks threading.

De: "tand.read" 

> Something very strange goes on and probably
> the wise thing is to use old good rc3.d links

Strange indeed. You could try adding an insulation layer between
systemd and your script by setting ExecStart to a C program that
merely execs you script. Something along the lines of

#include 
int main(int argc, char *argv[])
{
  execl("/bin/bash", "/bin/bash", "/root/bin/mytest.sh", "start", (char *) 0);
}



Re: systemd and bash scripts

2016-02-27 Thread Jean-Baptiste Thomas
De: "tand.read" 

> I am testing my own systemd unit (a service) that has this
> [service] section:

> Type=oneshot
>
> RemainAfterExit=yes
> ExecStart=/root/bin/mytest.sh start
> ExecStop=/bin/echo /root/bin/mytest.sh stop
>
> ("Want="-ed by multi-user.target and "After=" local-fs.target)
> and I try it out with systemctl start/stop-ing it when the
> system is fully on the ExecStop works fine, showing in
> journalctl, but ExecStart does nothing (not a single line in
> journal), and systemctl status shows it as "loaded" and
> "active (exited)", but not a single line of the mytest.sh
> script has run
>
> The only difference I see with ExecStart and ExecStop is that
> the stop-one calls a binary (and works) while the start-one
> calls a script (and goes to the bitbucket). Is there any
> shadowy setting that causes systemd NOT to run bash scripts as
> Exec* directives?

Does mytest.sh have sane permissions (chmod 755) ?

Is it placed where systemd can access it ? Does it work better
when it's in /tmp or some such ?

Do

  ExecStart=bash /root/bin/mytest.sh start

or

  ExecStart=/bin/bash /root/bin/mytest.sh start

work any better ?



Re: Need mentorship and support

2016-02-26 Thread Jean-Baptiste Thomas
De: "Himanshu Shekhar" 

> The problem is about reading metacharacters. For example, username is
> "harry", password is "harry@123" , proxy server "10.101.12.1:8080".
> Thus, apt.conf would have text
> "http://harry:harry@123@10.101.12.1:8080";.
>
> This leads to unwanted behaviour. Apt stops reading the password after
> the first @, but it should after the last one.
> How to resolve this?

I find your choice of words confusing. Firstly "@" is not a
"metacharacter", not for the shell anyway. Secondly, if an at
sign ends up in apt.conf, it means that your script successfully
"read" it, right ? So it's not a shell problem, it's an Apt
problem.

Things you could try :

- Editing apt.conf and manually replacing the first "@" by
  "%40". Or maybe even "\@", "\\@", "\100", "\0100", "\x40",
  that sort of thing.

- Seeing what RFC 3986 and Apt's documentation have to say on
  the matter.



Re: Need mentorship and support

2016-02-26 Thread Jean-Baptiste Thomas
De: "Himanshu Shekhar" 

> Also, I would love to know about good sources to learn and practice
> Bash. I followed "The Linux Command Line by William E. Shotts".

Chris F A Johnson has written two books on the subject. Haven't
read them but he used to be a regular on comp.unix.shell and he
seems to know what he's talking about.

/Shell Scripting Recipes: A Problem-Solution Approach/
http://cfajohnson.com/books/cfajohnson/ssr/

/Pro Bash Programming: Scripting the GNU/Linux Shell/
http://cfajohnson.com/books/cfajohnson/pbp/

> > 6) Lots of variable references without double quotes around them,
> > EG when calling configure_apt(). What if, say, the password
> > contains white space or "?" or "*" or "[" ?
>
> Please tell me about how to read special characters as @, ? etc. in
> password, as @ is the point after authentication where IP starts.

I'm not sure I understand the question. I don't expect read to
have problems with occurrences of "@" or "?" in its input (but
see its -r option).

The problem is not stuffing shell metacharacters into a
variable, it's what happens when you reference that variable.
Suppose variable v contains "*" (an asterisk). Compare the
output of

  echo "$v"

and that of

  echo $v

Or set v to "a b" then contrast the result of

  mkdir "$v"

with

  mkdir $v

The explanation is that when you write a command line like

  cmd $v

the shell splits the value of v into words, performs pathname
expansion on each word and uses the result of that as the
arguments to cmd. You might intend to pass one argument to cmd
but you may end up passing zero, two or a thousand.

Sometimes, that is what you want. But usually what you want is
to pass one argument equal to the value of v. The syntax for
that is :

  cmd "$v"

This also applies to constructs like if [ condition ]. When
someone writes

  if [ $variable = "constant" ]

there's a high probability that he or she really means

  if [ "$variable" = constant ]



Program to update udev rules after adding an ethernet adapter ?

2016-02-24 Thread Jean-Baptiste Thomas
When you install Debian on a PC, you get one line in
/etc/udev/rules.d/70-persistent-net.rules for each ethernet
adapter present.

If you add a network adapter after installation,
70-persistent-net.rules needs updating. Is there a program that
can do it for you ?



Re: Debian package on Windows

2016-02-22 Thread Jean-Baptiste Thomas
De: "Ric Moore" 
> and the GPL notice is included. I saw no mention to avoid the GPL in his 
> request for information. Ergo, as long as the GPL is honored, this plan 
> is actually a plus for Debian.

How is Debian better off from Microsoft porting apt to Windows ?



Re: bash-completion, tab and ambiguous globs

2016-02-19 Thread Jean-Baptiste Thomas
> I wouldn't want to get by without tab completion either, but
> programmable completion as I've seen it implemented in packages provided
> by Debian seems to break some behaviors in the built-in tab completion
> on which I had come to rely, so I always turn it off on my machines.

By "turning off" bash-completion, do you mean uninstalling it or
something less radical ?



Re: 5000 Folders in a directory

2016-02-18 Thread Jean-Baptiste Thomas
> *samueloph@teste:~/foo$ time ( for i in $(seq 0 ) ; do touch $i ; done
> )real0m10.245suser0m3.332ssys0m1.576s*
> Using shell built-in ">" to create 1 files:
ā€‹>
> *samueloph@teste:~/foo$ time ( for i in $(seq 0 ) ; do > $i ; done
> )real0m0.742suser0m0.064ssys0m0.120sā€‹*
>
> ā€‹">" is at least 10x faster than touch.ā€‹

Your spirit of healthy scepticism is admirable but what these
tests compare is not so much the time it takes to create a file
with ">" vs touch(1) than the time it takes to create a process
relative to the time it takes for the shell to iterate through
a for() loop.

Try "seq 0  | xargs touch" (3 process creations instead of
10,001). It will almost certainly be even faster than the ">"
version.



bash-completion, tab and ambiguous globs

2016-02-16 Thread Jean-Baptiste Thomas
In bash, typing, say, "ls x*y" then tab lists all the possible
expansions of "x*y" on the next line, then prints the command
line anew with "x*y" replaced by longest common stem.

With bash-completion installed, "x*y" is summarily replaced by
its first match.

Is there any way to restore the normal function of tab, besides
deinstalling bash-completion ?

Thanks in advance.