Re: [FUG-BR] crontab + "du -s" = bug

2007-02-10 Por tôpico pc\.suporte
Ricardo e Victor,

Muito Obrigado pela ajuda.
Quando vierem pra Curitiba/PR me mandem um e-mail ([EMAIL PROTECTED]) que a 
cerveja é por minha conta :D

Abraço,
Carlos Fischer


-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] crontab + "du -s" = bug

2007-02-09 Por tôpico Victor Loureiro Lima
Em 09/02/07, Ricardo Nabinger Sanchez<[EMAIL PROTECTED]> escreveu:
> On Fri,  9 Feb 2007 18:10:00 -0200
> "pc.suporte" <[EMAIL PROTECTED]> wrote:
>
> > Se eu executo do shell o comando: "du -s /etc" eu obtenho como resposta:
> > "1672/etc" Agora se eu executo o mesmo comando "du -s /etc" através da
> > crontab eu obtenho a resposta "3344/etc" Ou seja a crontab retorna
> > o DOBRO do tamanho que realmente é. Isso vale pra qualquer diretório, não
> > necessáriamente o /etc.
>
> Não é bug, é BLOCKSIZE padrão em 512.
>
> % setenv BLOCKSIZE 512
> % du -s /lib
> 6508/lib
>
> % setenv BLOCKSIZE 4096
> % du -s /lib
> 814 /lib
>
> % setenv BLOCKSIZE 1024
> % du -s /lib
> 3254/lib
>
> du(1)
> ENVIRONMENT
>  BLOCKSIZE  If the environment variable BLOCKSIZE is set, and the -k
> option is not specified, the block counts will be displayed in
> units of that size block.  If BLOCKSIZE is not set, and the -k
> option is not specified, the block counts will be displayed in
> 512-byte blocks.
>
> --
> Ricardo Nabinger Sanchez <[EMAIL PROTECTED],wait4.org}>
> Powered by FreeBSD
>
>   "Left to themselves, things tend to go from bad to worse."
> -
> Histórico: http://www.fug.com.br/historico/html/freebsd/
> Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
>

Exatamente, perguntei na -hackers@ e o pessoal respondeu isso mesmo:

du uses the BLOCKSIZE environment variable to decide what size blocks
to display. Crontab commands don't run with your environment; they run
with a very restricted one. This is documented in the du manual page.

> Weird bug...

Someone probably set BLOCKSIZE in your environment. Try using "du -sk" to
force du to use 1k blocks.
---

victor
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] crontab + "du -s" = bug

2007-02-09 Por tôpico Ricardo Nabinger Sanchez
On Fri,  9 Feb 2007 18:10:00 -0200
"pc.suporte" <[EMAIL PROTECTED]> wrote:

> Se eu executo do shell o comando: "du -s /etc" eu obtenho como resposta:
> "1672/etc" Agora se eu executo o mesmo comando "du -s /etc" através da
> crontab eu obtenho a resposta "3344/etc" Ou seja a crontab retorna
> o DOBRO do tamanho que realmente é. Isso vale pra qualquer diretório, não
> necessáriamente o /etc.

Não é bug, é BLOCKSIZE padrão em 512.

% setenv BLOCKSIZE 512
% du -s /lib
6508/lib

% setenv BLOCKSIZE 4096
% du -s /lib
814 /lib

% setenv BLOCKSIZE 1024
% du -s /lib
3254/lib

du(1)
ENVIRONMENT
 BLOCKSIZE  If the environment variable BLOCKSIZE is set, and the -k
option is not specified, the block counts will be displayed in
units of that size block.  If BLOCKSIZE is not set, and the -k
option is not specified, the block counts will be displayed in
512-byte blocks.

-- 
Ricardo Nabinger Sanchez <[EMAIL PROTECTED],wait4.org}>
Powered by FreeBSD

  "Left to themselves, things tend to go from bad to worse."
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] crontab + "du -s" = bug

2007-02-09 Por tôpico Victor Loureiro Lima
> Como nao achei a versao do du(1), mandei um md5 para verificarmos se a
> nossa se trata da mesma (meio nao confiavel ;))
> MD5 (/usr/bin/du) = 8f96a7eb887e15d296aff89fc08eb396

Corrigindo, $FreeBSD: src/usr.bin/du/du.c,v 1.38.2.1 2006/06/04
10:23:08 maxim Exp$

victor loureiro lima
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] crontab + "du -s" = bug

2007-02-09 Por tôpico Victor Loureiro Lima
Em 09/02/07, pc.suporte<[EMAIL PROTECTED]> escreveu:
> Olá pessoALL,
>
> Estou com um probleminha. Acho q é um bug ou talvez uma característica.
> Se eu executo do shell o comando: "du -s /etc" eu obtenho como resposta: 
> "1672/etc"
> Agora se eu executo o mesmo comando "du -s /etc" através da crontab eu 
> obtenho a resposta "3344/etc"
> Ou seja a crontab retorna o DOBRO do tamanho que realmente é. Isso vale 
> pra qualquer diretório, não necessáriamente o /etc.
>
> Alguém já viu isso???

Foi reproduzido corretamente aqui em casa tambem, interessante esse
tipo de erro sim!?
Vou dar uma investigada a mais, mas ja' vale a pena abrir um PR no
freebsd.org para investigacao desse bug, porque e' um bug,o' nao
sabemos aonde!!!

FreeBSD zion 6.2-RELEASE FreeBSD 6.2-RELEASE #19: Thu Feb  8 11:00:59
BRST 2007 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/zion.kernel  amd64

Como nao achei a versao do du(1), mandei um md5 para verificarmos se a
nossa se trata da mesma (meio nao confiavel ;))
MD5 (/usr/bin/du) = 8f96a7eb887e15d296aff89fc08eb396

valeu,
victor f. loureiro lima
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


[FUG-BR] crontab + "du -s" = bug

2007-02-09 Por tôpico pc\.suporte
Olá pessoALL,

Estou com um probleminha. Acho q é um bug ou talvez uma característica. 
Se eu executo do shell o comando: "du -s /etc" eu obtenho como resposta: "1672  
  /etc" 
Agora se eu executo o mesmo comando "du -s /etc" através da crontab eu obtenho 
a resposta "3344/etc"
Ou seja a crontab retorna o DOBRO do tamanho que realmente é. Isso vale pra 
qualquer diretório, não necessáriamente o /etc.

Alguém já viu isso???

Obrigado,

Carlos Fischer


-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd